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 chenone <on...@alcatel.com.cn> on 2001/12/03 04:35:20 UTC

Re: RollingFileAppender does not back up the log file.

Hi,

If the log file is over 10M, It can create a backup log file automatically.
because you set the backup number is
2(log4j.appender.com.company.DBManager.MaxBackupIndex=2
), you can save 2 log files as the backup files. In another word, you always
get three files in the log directory, one is current file, the other two are
backup files. Remember! when your current log file is over 10M, the backup
file will be created. That is the result.

B.R.
Chenyi

----- Original Message -----
From: <ma...@senasystems.com>
To: <lo...@jakarta.apache.org>
Sent: Thursday, December 06, 2001 3:11 PM
Subject: RollingFileAppender does not back up the log file.


Hi,

I'm new to this mailing list and relatively new to log4j too. We've want to
use the RollingFileAppender to help roll over the log files after every
10MB. Towards this I have set up the properties like this:

log4j.rootCategory=debug,com.company.DBManager

log4j.category.com.company.DBManager=debug,com.company.DBManager

log4j.additivity.com.company.DBManager=false

log4j.appender.com.company.DBManager.File=d:/st/sdk/logs/sdk.log
log4j.appender.com.company.DBManager=org.apache.log4j.RollingFileAppender
log4j.appender.com.company.DBManager.MaxFileSize=10KB
log4j.appender.com.company.DBManager.MaxBackupIndex=2
log4j.appender.com.company.DBManager.layout=org.apache.log4j.PatternLayout
log4j.appender.com.company.DBManager.layout.ConversionPattern=[%t][%d{dd MMM
HH:mm:ss}][%x][-%5p] - %m%n

The properties are read from a file into my java code:

fstream = new FileInputStream(propertyFilename);
Properties myProperties = new Properties();
myProperties.load(fstream);
PropertyConfigurator.configure(myProperties);

What happens is that the log file (sdk.log) keeps getting overwritten
without a backup being created at all. I've checked the mailing list for
other similar messages but this has never been a problem for anyone. Can you
tell me what I'm doing wrong?

thanks,
Manav


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>