log4net print DateTime/calling class/function on each line
I开发者_如何学运维s there any way using log4net to automatically write date/time and class name/function name to the start of each logged line?
In the log4net
configuration file modify Appender section by adding a PatternLayout with custom format. Following pattern will output DateTime ClassName.MethodName
<appender name="DebugOut"
type="log4net.Appender.OutputDebugStringAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date{MM/dd/yy HH:mm} %C{1}.%M" />
</layout>
</appender>
You can output fully qualified name of class by changing %C{1}
to %C
精彩评论