logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbell2012 <b311b-nab...@theotherbell.com>
Subject RollingLogFileAppender skips numbers when rolling
Date Fri, 02 Nov 2012 15:31:33 GMT

My log4net.config looks like this:

<log4net>
  <appender name="RollingLogFileAppender"
type="log4net.Appender.RollingFileAppender">
    <file type="log4net.Util.PatternString"
value="%property{log4net:HostName}-Athena.log"/>
    <appendToFile value="true"/>
    <datePattern value="-yyyy-MM-dd.&quot;log&quot;"/>
    <rollingStyle value="Composite"/>
    <maximumFileSize value="5MB"/>
    <maxSizeRollBackups value="100" />
    <staticLogFileName value="true" />
    <countDirection value="1" />
    <layout type="Common.Log.AwarenessPatternLayout">
      <conversionPattern value="%-5p %d %5t %-30.30c{1} %-30.30M
%property{reqpath} %m%n" />
    </layout>
  </appender>
  <root>
    <level value="DEBUG"/>
    <appender-ref ref="RollingLogFileAppender"/>
  </root>
</log4net>

Common.Log.AwarenessPatternLayout is a custom class that extends
PatternLayout and overrides the Header property so we get some standard info
at the top of our logs.

On 10-19, everything starts out ok:

 * The current log file name is chi1093665web08-Athena.log.
 * The first log is chi1093665web08-Athena.log-2012-10-19.log.1
 * The next one is chi1093665web08-Athena.log-2012-10-19.log.2, up to
.log.13.

On 10-20:

 * The current log file name is chi1093665web08-Athena.log.
 * The first log is chi1093665web08-Athena.log-2012-10-20.log.1
 * The next one is chi1093665web08-Athena.log-2012-10-20.log.2
 * The third one is chi1093665web08-Athena.log-2012-10-20.log.14 (3 through
13 are missing)

This continues day after day where the current log and the oldest logs are
fine... but then it starts incrementing from the highest number of the
previous day.

The only time I don't see this behavior is on a day where the # logs is less
than the previous day's max # - 10. I.e., on the 21st I only had four logs
(current + 3 backups) and everything was fine. On the 22nd, I had more than
4 so the 4th backup was renamed to log.15.
-- 
View this message in context: http://old.nabble.com/RollingLogFileAppender-skips-numbers-when-rolling-tp34633527p34633527.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message