Log4Net Console in color

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net"/>
  </configSections>
  <log4net>
    <appender name="Console" type="log4net.Appender.ColoredConsoleAppender">
      <mapping>
        <level value="ERROR"/>
        <foreColor value="Red, HighIntensity"/>
      </mapping>
      <mapping>
        <level value="WARN"/>
        <backColor value="Yellow"/>
        <foreColor value="Blue, HighIntensity"/>
      </mapping>
      <mapping>
        <level value="INFO"/>
        <foreColor value="White"/>
      </mapping>
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%d{HH:mm:ss} %-5p %M: %m%n" />
      </layout>
      <param name="Threshold" value="INFO" />
    </appender>
    <root>
      <appender-ref ref="Console" />
    </root>
  </log4net>
</configuration>
log4netcolor

More info about ColoredConsoleAppender

Comments

Popular posts from this blog

Tibco Rendezvous (tibrv) C# .Net example

Parse XML to dynamic object in C#