Hi

Use a RollingFileAppender. Set the MaxBackupIndex to the number of logs
you want to maintain, and the MaxFileSize to the size of each logs file
before it ROLLS over to the next log.

In log4j.xml:

<appender name="CSF_FILE" class="org.apache.log4j.RollingFileAppender"> 
        <param name="Threshold" value="INFO"/>
        <param name="File" value="server.log"/> 
        <param name="Append" value="true"/>
        <param name="MaxFileSize" value="500KB"/> 
        <param name="MaxBackupIndex" value="10"/>
        <layout class="org.apache.log4j.PatternLayout"> 
                <param name="ConversionPattern" value="%d %-5p [%c]
%m%n"/> 
        </layout> 
</appender>

Hope this helps.
Graham Renney 

-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Abhay
Sent: Thursday 23 February 2006 21:38
To: [email protected]
Subject: Rolling over to another file when the log is full

Hi,

I have a requirement, wherein i need to roll over to another file when
my log is full.

Example : sco.log
 If this file is full, i should'nt loose the logs, i want to keep the
history of logs


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

This message and any attachments are confidential and intended solely for the 
addressee. If you have received this message in error, please notify Discovery 
immediately, telephone number +27 11 529 2888. Any unauthorised use; alteration 
or dissemination of the contents of this email is strictly prohibited. In no 
event will Discovery or the sender be liable in any manner whatsoever to any 
person for any loss or any direct, indirect, special or consequential damages 
arising from use of this email or any linked website, including, without 
limitation, from any lost profits, business interruption, loss of programmes or 
other data that may be stored on any information handling system or otherwise 
from any assurance that this email is virus free even if Discovery is expressly 
advised of the possibility of such damages. Discovery is an Authorised 
Financial Services Provider.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to