I'm interested in the answer.  I use <rollingStyle 
value="Size"><maxSizeRollBackups value="2">; I lack the imbedded date, but it 
does the right thing on restart.  I recall starting with a setup like that 
below (<rollingStyle value="Composite">), and recall seeing this same behavior, 
and finally being told that it was a limitation of the implementation.  True?

rich

________________________________
From: Pascal ROZE [mailto:pascal.r...@gmail.com]
Sent: Friday, June 01, 2012 12:19 PM
To: Log4NET User
Subject: Log files overwritten

Hello everyone

I have a rolling file appender hosted in an IIS 6.0 application that looks like:

<appender name="RollingFileError" type="log4net.Appender.RollingFileAppender">
    <file value="C:\Logfiles\"/>
    <datePattern value="Error\s.yyyyMMdd.lo\g"/>
    <threshold value="ALL"/>
    <appendToFile value="true"/>
    <rollingStyle value="Composite"/>
    <maximumFileSize value="1MB"/>
    <maxSizeRollBackups value="-1" />
    <countDirection value="1" />
    <staticLogFileName value="false"/>
    <preserveLogFileNameExtension value="true"/>
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="*%-10level %-30date %-25logger 
%-15property{log4net:HostName} ThreadID: %-10thread %message %newline"/>
    </layout>
  </appender>

So, at the end of the day, I have some files like Errors.20120601.0.log, 
Errors.20120601.1.log, Errors.20120601.2.log and so on.

But, if the application is restarted during the day, log file names restart 
from 0 and the existing files are overwritten one after the other.

How to avoid that?

Thanx for your help

Pascal

Reply via email to