Created
March 13, 2012 08:49
-
-
Save clupasq/2027652 to your computer and use it in GitHub Desktop.
log4net colored console+flat file appender configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> | |
</configSections> | |
<log4net> | |
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender"> | |
<mapping> | |
<level value="WARN"/> | |
<foreColor value="Yellow"/> | |
</mapping> | |
<mapping> | |
<level value="ERROR"/> | |
<foreColor value="Red"/> | |
</mapping> | |
<mapping> | |
<level value="FATAL"/> | |
<foreColor value="White"/> | |
<backColor value="Red" /> | |
</mapping> | |
<mapping> | |
<level value="INFO"/> | |
<foreColor value="Cyan"/> | |
</mapping> | |
<mapping> | |
<level value="DEBUG"/> | |
<foreColor value="Green"/> | |
</mapping> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/> | |
</layout> | |
</appender> | |
<appender name="FileAppender" type="log4net.Appender.FileAppender"> | |
<file value="info.log" /> | |
<appendToFile value="true" /> | |
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%utcdate [%-3thread] %-5level - %message (%logger)%newline"/> | |
</layout> | |
</appender> | |
<root> | |
<level value="DEBUG" /> | |
<appender-ref ref="ColoredConsoleAppender"/> | |
<appender-ref ref="FileAppender"/> | |
</root> | |
</log4net> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: log4net.Config.XmlConfigurator(Watch = true)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configSections> | |
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> | |
</configSections> | |
<log4net> | |
<appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender"> | |
<mapping> | |
<level value="WARN"/> | |
<foreColor value="Yellow"/> | |
</mapping> | |
<mapping> | |
<level value="ERROR"/> | |
<foreColor value="Red"/> | |
</mapping> | |
<mapping> | |
<level value="DEBUG"/> | |
<foreColor value="Green"/> | |
</mapping> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%date [%thread] %-5level %logger - %message%newline"/> | |
</layout> | |
</appender> | |
<appender name="FileAppender" type="log4net.Appender.FileAppender"> | |
<file value="info.log" /> | |
<appendToFile value="true" /> | |
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> | |
<layout type="log4net.Layout.PatternLayout"> | |
<conversionPattern value="%utcdate [%-3thread] %-5level - %message (%logger)%newline"/> | |
</layout> | |
</appender> | |
<root> | |
<level value="DEBUG" /> | |
<appender-ref ref="ColoredConsoleAppender"/> | |
<appender-ref ref="FileAppender"/> | |
</root> | |
</log4net> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment