You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by ju...@pta.de on 2010/04/07 19:30:34 UTC

Log4net RollingFileAppender stops to roll over

Hello,

I'm using log4net v1.2.10 and encountered the following problem:
I'm using a rolling file appender and everything worked quite fine for a
while. But suddenly (after some weeks) the RollingFileAppender stops to
roll over for no obvious reason (at least I can see no reason) and now I
have a really very big log file.
Can you help me?

The application runs on a Windows 2003 system. Here comes my config file:

++++++++++++++++++++++++++
<?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\\CWS\\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"/> <!-- INFO, ERROR, DEBUG, ALL -->
      <appender-ref ref="RollingLogFileAppender"/>

</root>
</log4net>
++++++++++++++++++++++++++

Thanks for your help!

Juergen

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************


PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschaeftsfuehrer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

Antwort: RE: Log4net RollingFileAppender stops to roll over

Posted by ju...@pta.de.
I already erased all old files but no effect.
There must be some other problem...



PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************


PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschaeftsfuehrer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

RE: Log4net RollingFileAppender stops to roll over

Posted by Alasdair Richardson <al...@jabcap.com>.
I am not an expert on log4net .. But the first thing I would check is how many log files you actually have? If = 50 then I would suspect that  MaxsizeRollBackups is not doing what the doc says it should do (ie erasing old files) after 7 weeks one day. If != 50 then there is some other problem.

-----Original Message-----
From: juergen.ernst@pta.de [mailto:juergen.ernst@pta.de] 
Sent: 07 April 2010 19:31
To: log4net-user@logging.apache.org
Subject: Log4net RollingFileAppender stops to roll over


Hello,

I'm using log4net v1.2.10 and encountered the following problem:
I'm using a rolling file appender and everything worked quite fine for a
while. But suddenly (after some weeks) the RollingFileAppender stops to
roll over for no obvious reason (at least I can see no reason) and now I
have a really very big log file.
Can you help me?

The application runs on a Windows 2003 system. Here comes my config file:

++++++++++++++++++++++++++
<?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\\CWS\\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"/> <!-- INFO, ERROR, DEBUG, ALL -->
      <appender-ref ref="RollingLogFileAppender"/>

</root>
</log4net>
++++++++++++++++++++++++++

Thanks for your help!

Juergen

PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************


PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschaeftsfuehrer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

________________________________
The information contained in this transmission
is intended only for the person or entity to 
which it is addressed and may contain confid-
ential and/or privileged information. If you 
are not the intended recipient (or have received 
this e-mail in error) please notify the sender 
immediately and delete this e-mail. Any unauth-
orised copying, disclosure or distribution of
the material in this e-mail is strictly forbidden.


GetLastWriteTime in RollingFileAppender.RollOverIfDateBoundaryCrossing seems to return wrong date

Posted by ju...@pta.de.
Hello,

it seems that the Method of  System.IO.File GetLastWriteTime sometimes
returns the current time insted of the time the log file or directory was
last written to.
What i've don was this: I activated log4net internal logging and checked
the RollingFileAppender.cs file. It seems that everey time, log4net calls
GetLastWriteTime (in RollingFileAppender.RollOverIfDateBoundaryCrossing,
line 781 it gets the current time. If it then compares this result with the
current time (to decide if a new file should be created) theses times are
the same and therefore no new file is created for that reason.
Is this a known bug? (My system is a Win2003 server.)

Juergen



PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschäftsführer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer

**********************************************************************
http://www.pta.de
Mit 1875 Erfahrungsberichten aus 41 Jahren erfolgreicher Projektarbeit!
**********************************************************************


PTA Programmier-Technische Arbeiten GmbH
Seckenheimer Str. 65-67, 68165 Mannheim
Amtsgericht Mannheim, HRB 1139
USt-IdNr.: DE 143 839 368
Geschaeftsfuehrer:
Dipl.-Ing. Peter Fischer
Dr. Harald W. Busch
Dipl.-Kfm. Knut Fischer