<layout type="log4net.Layout.PatternLayout"> <converter> <name value="myConverter" /> <type value="TestApp.MyPatternConverter, TestApp" /> </converter> <conversionPattern value="%-5level %logger - %myConverter - %message%newline" /> </layout>
<file type="log4net.Util.PatternString"> <converter> <name value="folder" /> <type value="TestApp.SpecialFolderPatternConverter,TestApp" /> </converter> <conversionPattern value="%folder{LocalApplicationData}\log-file.txt" /> </file>
public class SpecialFolderPatternConverter : log4net.Util.PatternConverter { override protected void Convert(System.IO.TextWriter writer, object state) { Environment.SpecialFolder specialFolder = (Environment.SpecialFolder)Enum.Parse(typeof(Environment.SpecialFolder), base.Option, true); writer.Write(Environment.GetFolderPath(specialFolder)); } }
<layout type="log4net.Layout.PatternLayout" value="%message%newline" />
Framework | Website |
---|---|
Microsoft .NET Framework 1.1 Final Beta (1.1.4322) | http://msdn.microsoft.com/net |
Microsoft .NET Compact Framework 1.0 (1.0.5000) | http://msdn.microsoft.com/vstudio/device/compactfx.asp |
Mono 0.23 | http://www.go-mono.org |
Microsoft Shared Source CLI 1.0 | http://msdn.microsoft.com/library/en-us/dndotnet/html/mssharsourcecli.asp |
<appender> <param name="Evaluator"> <object type="log4net.spi.LevelEvaluator"> <constructor> <param type="log4net.spi.Level" value="DEBUG"/> </constructor> </object> </param> </appender>
<appender> <evaluator type="log4net.spi.LevelEvaluator"> <threshold value="DEBUG"/> </evaluator> </appender>
Extension | Description |
---|---|
log4net.Ext.Trace | Adds trace logging methods |
log4net.Ext.EventID | Adds additional eventId parameter to all methods |