views:

251

answers:

1

Hello,

I'm using log4net (v1.2.9.0) in a web project. Everything works like a charm, but after a couple of weeks the RollingFileAppender stops to roll over. Instead every log message is appended to the same file which therefore has a giant size by now.

Here is my log4net configuration:

<?xml version="1.0" encoding="utf-8"?>
<log4net>
  <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
  <param name="File" value="C:\\Documents and Settings\\All Users\\Application Data\\CAPServer\\log\\CWSServer.log"/>
  <param name="AppendToFile" value="true"/>
  <param name="MaxSizeRollBackups" value="50"/>
    <param name="RollingStyle" value="Date"/>
    <param name="DatePattern" value="yyyyMMdd"/>
    <param name="StaticLogFileName" value="true"/>
  <layout type="log4net.Layout.PatternLayout">
   <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} [%t] %-5p %c{1} - %m%n"/>
  </layout>
 </appender>
 <root>
  <level value="ALL"/>
  <appender-ref ref="RollingLogFileAppender"/>
 </root>
</log4net>

Can you help?

Thanks in advance, Rocko

+1  A: 

A couple of things to try from the documentation on http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.html:

Try removing the entry for MaxSizeRollBackups.

CAUTION
A maximum number of backup files when rolling on date/time boundaries is not supported.

Try clearing out the directory of all log files.

CAUTION
Changing StaticLogFileName or CountDirection without clearing the log file directory of backup files will cause unexpected and unwanted side effects.

Even Mien
Related question: http://stackoverflow.com/questions/95286/log4net-set-max-backup-files-on-rollingfileappender-with-rolling-date
Even Mien
Sorry for the late reply, but I was ill for a couple of days. But now I was able to test your recommendations but with no result. It still didn't roll over. I even tried to update to v1.2.10. Still the same behaviour.Do you have any addtional ideas?
Rocko