You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Harkishin Nachnani <hn...@microaut.com> on 2001/02/09 22:11:32 UTC

Log4J : Rolling File Appender Max File Size

Hi all
I want to set up a maximum file size of 10 KB and back up 3 copies of the
log. But for some reason, it doesn't work. Please help.
Following is my lcf file

log4j.rootCategory=DEBUG, file, console

#FILE
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=AgentWorkstation.log
# Append to file if it aleady exists.
log4j.appender.file.Append=true
log4j.appender.A1.MaxFileSize=10KB
#keep 3 back up files
log4j.appender.A2.MaxBackupIndex=3
#Output Pattern
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS}
%-5p (%C{1}:%L) - %m\n

#DOS PROMPT
log4j.appender.console=org.apache.log4j.FileAppender
log4j.appender.console.File=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS}
%-5p (%C{1}:%L) - %m\n

RE: Log4J : Rolling File Appender Max File Size

Posted by Rex Madden <re...@microcreditcard.com>.
Your property file is a little off:

The A1 and A2 aren't necessary and should be "file", since that's what you
named your appender
(log4j.appender.file=org.apache.log4j.RollingFileAppender).  Therefore, your
file should have:

log4j.appender.file.MaxFileSize=10KB
log4j.appender.file.MaxBackupIndex=3

instead of:

log4j.appender.A1.MaxFileSize=10KB
log4j.appender.A2.MaxBackupIndex=3

-----Original Message-----
From: Harkishin Nachnani [mailto:hnachnani@microaut.com]
Sent: Friday, February 09, 2001 4:12 PM
To: log4j-user@jakarta.apache.org
Subject: Log4J : Rolling File Appender Max File Size

Hi all
I want to set up a maximum file size of 10 KB and back up 3 copies of the
log. But for some reason, it doesn't work. Please help.
Following is my lcf file

log4j.rootCategory=DEBUG, file, console

#FILE
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=AgentWorkstation.log
# Append to file if it aleady exists.
log4j.appender.file.Append=true
log4j.appender.A1.MaxFileSize=10KB
#keep 3 back up files
log4j.appender.A2.MaxBackupIndex=3
#Output Pattern
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS}
%-5p (%C{1}:%L) - %m\n

#DOS PROMPT
log4j.appender.console=org.apache.log4j.FileAppender
log4j.appender.console.File=System.out
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss,SSS}
%-5p (%C{1}:%L) - %m\n

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org