One way to achieve this would be to subclass the
DailyRollingFileAppender and re-implement the roll method (I think that
is what it is called). Inside this method you would delete any file
older than 3 days and rename the rest.

Check the javadoc for the exact specification.

Cheers,
Philip. 

-----Original Message-----
From: nithya rajeev [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, September 05, 2006 12:17 PM
To: [email protected]
Subject: [BULK] MaxBackupIndex
Importance: Low

Hello-
I am new to log4j. This is teh first time I am setting it up for my
application. I want to keep the log files which are ONLY 3 days old and
newer. Any log file older than 3 days should get deleted. And I have
specified using the MaxBackupIndex property. But still the files never
get deleted. I have to manually delete them. Can some give some
pointers/tips as to why this is not happening as expected. Here is my
log4j.properties.
Thanks.


# initialise root logger with level INFO log4j.rootLogger=INFO,LOGMAIN

# LOGMAIN APPENDER
log4j.appender.LOGMAIN=org.apache.log4j.DailyRollingFileAppender
log4j.appender.LOGMAIN.layout=org.apache.log4j.PatternLayout
log4j.appender.LOGMAIN.layout.ConversionPattern=%d{yyyy-MM-dd
HH:mm:ss.SSS} %-5p %m%n
log4j.appender.LOGMAIN.DatePattern='.'yyyy-MM-dd-a
log4j.appender.LOGMAIN.File=/log4j.txt
log4j.appender.LOGMAIN.MaxBackupIndex=3







IMPORTANT NOTICE
Email from TSI Terminal Systems Inc. (TSI) is confidential and may be legally 
privileged. If it is not intended for you, please delete it immediately unread. 
Under no circumstances should this e-mail be redistributed without prior 
written consent of TSI.  The internet cannot guarantee that this communication 
is free of viruses, interception or interference and anyone who communicates 
with us by email is taken to accept the risks in so doing. Without limitation, 
TSI and its affiliates accept no liability whatsoever and howsoever arising in 
connection with the use of this email. Under no circumstances shall this email 
constitute a binding agreement for provision of services by TSI, which is 
subject to the terms and conditions of TSI's standard schedule for Terminal 
Tariffs which is also available at http://www.tsi.bc.ca.

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

Reply via email to