Optimized Configuration for log4net

This commit is contained in:
Torben Nehmer 2016-11-19 22:51:06 +01:00
parent 9f324759cd
commit 98f235815b

View File

@ -1,29 +1,43 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<log4net> <log4net>
<!-- A1 is set to be a ConsoleAppender --> <appender name="Console" type="log4net.Appender.ColoredConsoleAppender">
<appender name="Console" type="log4net.Appender.ColoredConsoleAppender"> <layout type="log4net.Layout.PatternLayout">
<layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%-5timestamp [%thread] %-5level %logger - %message%newline" />
<conversionPattern value="%-5timestamp [%thread] %-5level %logger - %message%newline" /> </layout>
</layout> <mapping>
<mapping><level value="ERROR" /><foreColor value="Red, HighIntensity" /></mapping> <level value="ERROR" />
<mapping><level value="WARN" /><foreColor value="Yellow, HighIntensity" /></mapping> <foreColor value="Red, HighIntensity" />
</appender> </mapping>
<mapping>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender"> <level value="WARN" />
<file value="vcs.log" /> <foreColor value="Yellow, HighIntensity" />
<appendToFile value="true" /> </mapping>
<maximumFileSize value="100KB" /> </appender>
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout"> <!-- Optional - for performance Reasons, enable via root logger instead of RollingFile if desired-->
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" /> <appender name="BufferingForwardingAppender" type="log4net.Appender.BufferingForwardingAppender">
</layout> <appender-ref ref="RollingFile" />
</appender> <bufferSize value="64" />
<evaluator type="log4net.Core.LevelEvaluator">
<!-- Set root logger level to DEBUG and its only appender to A1 --> <threshold value="ERROR"/>
<root> </evaluator>
<level value="DEBUG" /> </appender>
<appender-ref ref="Console" />
<appender-ref ref="RollingFile" /> <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
</root> <file value="vcs.log" />
<appendToFile value="true" />
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="Console" />
<!-- appender-ref ref="BufferingForwardingAppender" / -->
<appender-ref ref="RollingFile" />
</root>
</log4net> </log4net>