PoshCode Archive  Artifact Content

Artifact 4b665d4c04d13cb2c791dbc72912291f83fb6d8a7c14259a6436b6f49e2e6c1b:

  • File default-config.ps1 — part of check-in [59c37f9797] at 2018-06-10 13:00:46 on branch trunk — An example config for Log4Net (user: Joel Bennett size: 1773)

# encoding: ascii
# api: xml
# title: default.config
# description: An example config for Log4Net
# version: 0.1
# author: Joel Bennett
# license: CC0
# x-poshcode-id: 1743
# x-archived: 2016-03-23T13:26:37
# x-published: 2011-04-06T22:16:00
#
#
<!-- An example log4net config (Save as default.config) -->
<log4net>
   <appender name="ColoredConsoleAppender" type="log4net.Appender.ColoredConsoleAppender">
       <mapping>
           <level value="ERROR" />
           <foreColor value="Red, HighIntensity" />
           <backColor value="White, HighIntensity" />
       </mapping>
       <mapping>
           <level value="DEBUG" />
           <foreColor value="Green, HighIntensity" />
       </mapping>
       <mapping>
           <level value="INFO" />
           <foreColor value="Cyan, HighIntensity" />
       </mapping>
       <mapping>
           <level value="WARN" />
           <foreColor value="Yellow, HighIntensity" />
       </mapping>
           <layout type="log4net.Layout.PatternLayout">
           <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
       </layout>
   </appender>

   <appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
       <file value="example.log" />
       <appendToFile value="true" />
       <maximumFileSize value="100KB" />
       <maxSizeRollBackups value="2" />

       <layout type="log4net.Layout.PatternLayout">
           <conversionPattern value="%level %thread %logger - %message%newline" />
       </layout>
   </appender>
    
    <root>
        <level value="DEBUG" />
        <appender-ref ref="ColoredConsoleAppender" />
        <appender-ref ref="RollingFile" />
    </root>
</log4net>