Here is a log4net output format, which uses slightly less log space than the default:
A small saving per line could make a big difference overall to log space :)
note: the documentation from Apache seems to be incorrect for log4net - as it says to use SSS for milliseconds, whereas log4net uses fff for milliseconds
This is the relevant extract from the log4net configuration:
EXAMPLE OUTPUT:
BEFORE:
2012-06-05 10:58:40,819 [1] INFO My App [(null)] - My App - ===star
ting....
AFTER:
06/05 11:17:29,151-{INFO}-My App - ===starting...
This is the full log4net configuration:
A small saving per line could make a big difference overall to log space :)
note: the documentation from Apache seems to be incorrect for log4net - as it says to use SSS for milliseconds, whereas log4net uses fff for milliseconds
This is the relevant extract from the log4net configuration:
<layout type="log4net.Layout.PatternLayout,log4net"> <!-- a reduced format, saves bit of log space: --> <param name="ConversionPattern" value="%date{MM/dd HH:mm:ss,fff}-{%level}-%message%newline"/> </layout>
EXAMPLE OUTPUT:
BEFORE:
2012-06-05 10:58:40,819 [1] INFO My App [(null)] - My App - ===star
ting....
AFTER:
06/05 11:17:29,151-{INFO}-My App - ===starting...
This is the full log4net configuration:
<log4net debug="false"> <!-- Define some output appenders --> <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender,log4net"> <param name="File" value="oLING_SINrenewals.log"/> <param name="AppendToFile" value="true"/> <param name="RollingStyle" value="Size"/> <param name="MaxSizeRollBackups" value="3"/> <param name="MaximumFileSize" value="200KB"/> <param name="StaticLogFileName" value="true"/> <layout type="log4net.Layout.PatternLayout,log4net"> <!-- a reduced format, saves bit of log space: -->
<param name="ConversionPattern" value="
%date{MM/dd HH:mm:ss,fff}-{%level}-%message%newline
"/>
</layout> </appender> <!-- Setup the root category, add the appenders and set the default priority --> <root> <priority value="INFO"/> <appender-ref ref="LogFileAppender"/> </root> <!-- Specify the priority for some specific categories --> <category name="OdinCommon"> <priority value="DEBUG"/> </category> </log4net>
Comments
Post a Comment