C# Log4Net configuration for multiple processes with date rolling

This example uses MinimalLock locking Model to allow multiple processes to write to the same file

<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
  <file value="Log\\MyApp.log"/>
  <appendToFile value="true"/>
  <rollingStyle value="Date"/>
  <datePattern value=".yyyyMMdd"/>
  <maxSizeRollBackups value="7"/>
  <staticLogFileName value="true"/>
  <threshold value="INFO"/>
  <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />                       
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%d [%t] %-5p %c.%M():%L - %m%n"/>
  </layout>
</appender>

Click here for more detailed post about Log4Net configuration in console apps

Comments

Popular posts from this blog

How to enable Kerberos Delegation in Google Chrome

Parse XML to dynamic object in C#