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 Otto Leung <ol...@traversenetworks.com> on 2005/07/27 18:41:07 UTC

log4j 1.2.8 RollingFileAppender problem

Hi all,

 

My servlets is using the log4j 1.2.8 jar, and it is also using axis.

 

Problem with RollingFileAppender:

 

I set the MaxBackupIndex to 10.  When it hits xxx.log.10 and when
xxx.log needs to roll, it deletes xxx.log.1 and reset .log to empty.
Overtime, xxx.log.1 to xxx.log.10 will be deleted, and the only log file
left is xxx.log.

 

Has anyone experienced the same?

 

My log4j.properties:

#### Use two appenders, one to log to console, another to log to a file

log4j.rootCategory=DEBUG, CONSOLE, R

 

# Set the enterprise logger

log4j.logger.org.apache.axis.enterprise=FATAL, CONSOLE, R 

 

# ignore debug axis messages

log4j.category.org.apache.axis=INFO, CONSOLE, R 

 

# Print only messages of priority WARN or higher for your category

log4j.category.your.category.name=WARN

 

#### First appender writes to console

log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender

log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout

 

# Pattern to output the caller's file name and line number.

log4j.appender.CONSOLE.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n

 

#### Second appender writes to a file

log4j.appender.R=org.apache.log4j.RollingFileAppender

log4j.appender.R.File=c:\\xxx.log

log4j.appender.R.Append=true 

log4j.appender.R.layout=org.apache.log4j.PatternLayout

log4j.appender.R.layout.ConversionPattern=%d{ISO8601} %p %t %c - %m%n

 

# Control the maximum log file size

log4j.appender.R.MaxFileSize=10KB  #10KB for testing

 

# Archive log files 

log4j.appender.R.MaxBackupIndex=10

 

Thanks in advance,

Otto