NET Logging Library
Defaults
Basic Tasks > Defaults

The .NET Logging Library Contains a Global Configuration and Defaults.  When global configuration is set, its effect is immediate accross all targets.  When default configuration is set, when a new target is added, the default will be used for certain properties for a logging target.

 

Global Configuration

Log.Config.SkipFrames
The number of frames to skip when getting the calling method. Useful when the logger is wrapped in another helper class.

Log.Config.IsDebugEnabled
Turn on/off logging when performing a Log.Debug

Log.Config.IsInfoEnabled
Turn on/off logging when performing a Log.Info

Log.Config.IsWarnEnabled
Turn on/off logging when performing a Log.Warn

Log.Config.IsErrorEnabled
Turn on/off logging when performing a Log.Error

Log.Config.IsFatalEnabled
Turn on/off logging when performing a Log.Fatal

Log.Config.IgnoreDuplicates
Ignore duplicate messges.  This is very useful when an infinite loop occurs so the log doesn't fill up with the same message.  See also MaxDuplicates.  By default is false.

Log.Config.StackInactivityTimeout
When doing a PushMethod.  This is the maximum time an item will be kept on the stack.  The default is 180 seconds (3 minutes)

Log.Config.AutoIncreaseLevel
When Log.LogException is used the default logging level automatically changes to Debug.  This is usefull for gathering more information after an exception occurs.  The default is false

Log.Config.IsFailSafeLoggingEnabled
By default, logging configuration exceptions are not thrown and only the Log.LoggingException property is set.  If IsFailSafeLoggingEnabled is set to false, all logging configuration exceptions will be thrown.  This is useful when initially setting up logging

Log.Config.GetCallingMethodDetails
By default, reflection is used to gather calling method information.  This can be turned off to increase performance.  When turned off these log fields will be blank: AssemblyName, FileName, ClassName, MethodName, Namespace, LineNUmber

Log.Config.GetEnvironmentInfo
By default, environmental info is gathered.  This can be turned off to increase performance.  When turned off these log fields will be blank:  UserName, MachineName, Identity, ProcessName

Log.Config.MaxDuplicates
When IgnoreDuplicates is set to true, duplicate log entries will be ignored after this number.  The default is 10 duplicates.

 

Defaults

Log.Config.DefaultBufferSize
When the LoggingMode is set to Buffered, this is the size of the buffer before writing to the target.  The default is 100

Log.Config.DefaultLoggingMode
By default all logging is synchronous.  This is a change from Version 1 of the logger where all targets were asynchronous. 

Log.Config.DefaultMaxLogEntries
For file and database targets, this is the default maximum number of entries before rolling occurs.  The default is 10,000.  By default the oldest entries will be discarded.  Set to zero for unlimited.

Log.Config.DefaultMessageFormat
The default message format for console and text files.
The default is %Indent%[%LogTime%] %Message%, Last Milliseconds: %TotalMilliseconds% [%LogLevel%] Machine: %MachineName% User: %UserName% Process: %ProcessName% CallingMethod: %CallingMethod% LineNumber: %LineNumber% %Additional%%NewLine%

Log.Config.DefaultFileRollingStyle
The default rolling style for files.  The default is to discard the oldest entries: RollingStyle.DiscardMaxLogEntries

Log.Config.DefaultRollingTimePeriod
The default period to archive roll file targets.  Set the RollingStyle of the target to ArchiveTimePeriod.  The default is RollingTimePeriod.Daily   

Log.Config.DefaultFileRollingMaxArchiveFiles
The maximum number of archive files when rolling file targets.  Also set the RollingStyle to ArchiveSize or ArchiveTimePeriod.  The default is 7

Log.Config.DefaultDateFormat
The default date format when logging to targets.  This is the %LogTime%. The default is "yyyy-MM-dd HH:mm:ss,fff".  Any .NET Date Formatting can be used.
See http://msdn.microsoft.com/en-us/library/az4se3k1.aspx and  http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx