XmlLogFile

Find Solution »
Submitted User: twostepted    Email User
Average Rating:
     
   Rate this Solution »
Solution Type: Other
Sub Type: General
Category: C#
Description:
XmlLogFile A .NET logging library which inherits from DefaultTraceListener and provides a variety of advantages over traditional text file logging. Most importantly, it allows you to view your log messages in a browser and can save space in situations where identical messages are repeatedly written to the log. It is easier to read and more colorful than plain text log files and includes features for automatic rollover after the log gets to be a bigger than a user defined size (in KiloBytes). You can create a log file like this (below). Don't forget to copy the included files "XmlLogFile.xslt" and "date.difference.template.xsl" into the log directory. XmlLogFile log = new XmlLogFile("AppName", "c:\path\to\logs", "XmlLogFile.xslt", DebugLevel.Info); log.MaxFileSize = 100; // size in KB log.FlushCount = 20; // flush to disk after this many messages Debug.Listeners.Add(log); Debug.AutoFlush = true; Debug.Write("A debug message"); log.Write("Log File created"); log.WriteLogEntry("Init", "Init message", DebugLevel.Summaries); log.WriteLogEntryFormat("Error", "Error was {0}", DebugLevel.Errors, "error description"); log.WriteLogEntry(new Exception("This writes a message with DebugLevel.Exceptions")); This log file will be flushed to disk after each 20 messages have been written or once the size of the log file exceeds 100KB. Also, because DebugLevel.Info was specified, only messages with DebugLevel of Info, Summaries, Warnings, Errors, and Exceptions will be included in the log file. Log files are written to the log directory with a name like this: AppName-2008_01_04-09.00.05-Info.xml Also, if the log directory doesn't exist, XmlLogFile will create the directory. Send feedback to twostepted@yahoo.com. Thanks for using XmlLogFile!
 
Payment Currency: 

Purchase for just $10.00

  Terms & Conditions »

You will be redirected to PayPal™ for this secure transaction. SpikeSolutions.NET will not hold your financial information. If you do not have a PayPal™ account you may still purchase this solution with your Credit Card.
Fraud Warning
We take online fraud seriously. All transactions are recorded and we will report any fraud attempt.
Your IP Address is : 38.107.191.86
9/8/2010 5:20:46 PM