I have no problem using and rolling over log files when they reach a specific
size.
I am using VS 2005, C#, Log4Net 1.2.10.0, .NET Framework v2.0.
The one thing I did have to research on was the maxSizeRollBackups (value = -1)
and countDirection (value = 1) attributes. This allows for an unlimited number
of rollover files the a naming scheme that minimizes the number of files that
have to be renamed during a rollover. When I had maxSizeRollBackups = 2, I
would just end up with a maximum of 2 rollover files. This was generally ok
until I did a stress test of my app and generated 10+ rollover files but ended
up with just the 2.
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="logs\SynchroV4.log"/>
<appendToFile value="true" />
<maximumFileSize value="2048KB" />
<maxSizeRollBackups value="-1" />
<countDirection value="1" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger -
%message%newline" />
</layout>
</appender>
<root>
<!-- Levels (from lowest to highest): ALL | DEBUG | INFO | WARN | ERROR |
FATAL | OFF | -->
<level value="INFO" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
Hope this helps.
Randall Price
Secure Enterprise Technology Initiatives
Microsoft Implementation Group
Virginia Tech Information Technology
1700 Pratt Drive
Blacksburg, VA 24060
Email: [EMAIL PROTECTED]
Phone: (540) 231-4396
From: Andres Collao [mailto:[EMAIL PROTECTED]
Sent: Monday, February 18, 2008 9:50 AM
To: [email protected]
Subject: Problem with maxSizeRollBackups
Hi,
I have a problem with maxSizeRollBackups or maximumFileSize, because i
try create two o more log file when your's size is more than 5 KB, but this is
not possible.
¿Are you have the same problem?
I use framework 1.1.4322, Vstudio 2003 ASP.NET and log4net 1.2.10
And my log4net configuration is:
<appender name="RollingFile"
type="log4net.Appender.RollingFileAppender">
<file value="procesos.log" />
<appendToFile value="true" />
<maximumFileSize value="5KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date %level %thread
%logger - %message%newline" />
</layout>
</appender>
________________________________
La información contenida en esta transmisión es confidencial, y no puede ser
usada, por otras personas que su (s) destinatario (s). El uso no autorizado de
la información contenida en esta transmisión puede ser sancionado criminalmente
de conformidad al Código Penal Chileno. Si ha recibido esta transmisión por
error, por favor destrúyala y notifique al remitente telefónicamente, con cobro
revertido al teléfono 56-2-2106600 o vía e-mail. Atendido que no existe
certidumbre que el presente mensaje no será modificado como resultado de su
transmisión por correo electrónico, Enaex S.A. no será responsable si el
contenido del mismo ha sido modificado.
The information contained in this transmission is confidential, and may not be
used or transmitted by any person other than its addressee(s). Unauthorized use
of the information contained in this transmission may be punished under the
Chilean Law. If received in error, please destroy it and notify the sender by
calling collect or e-mail. As there can be no certainty that this message will
not be modified as a result of its transmission via e-mail, Enaex .S.A. shall
not be responsible if the content of the same has been modified.