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 Na...@kp.org on 2004/03/02 21:58:27 UTC

Re: Log4j problem with Rolling file appender!

Hi,

We are currently using log4j-1.2.7 and deployed as a web application in 
WebSphere
application server. The setting for the Rolling File Appender is 

log4j.category.sca.kpol=ERROR, HL7_APPENDER_SCA 
log4j.additivity.sca.kpol=false
log4j.appender.HL7_APPENDER_SCA=org.apache.log4j.RollingFileAppender
log4j.appender.HL7_APPENDER_SCA.File=/logs/kporg/rxrefill/hl7_rxrefill_sca.log
log4j.appender.HL7_APPENDER_SCA.MaxFileSize=100KB
log4j.appender.HL7_APPENDER_SCA.MaxBackupIndex=1
log4j.appender.HL7_APPENDER_SCA.layout=org.apache.log4j.PatternLayout
log4j.appender.HL7_APPENDER_SCA.layout.ConversionPattern=%d{ISO8601} %-5p 
- %m%n

I am getting the following errors with this current setting, with the 
log4j backup file.

1. Wiping out the backup file: After log4j has taken the backup when the 
size is reached over 100KB, the size of hl7_rxrefill_sca.log.1 is 0KB. 
This is not happening always. But, I can't figure out the reason why it is 
wiping out the contents. 
2. Another weird behavior. Log4j is updating both the original file and 
back up file simultaneously once the back up has taken.

Appreciate you help.
Naidu


Re: Log4j problem with Rolling file appender!

Posted by Pradeep Kanwar <pk...@secf.com>.
Hi Naidu,
 You code runs fine on a standalone app on win2k m/c with log4j-1.2.8. It
has to be something with your webapp/websphere setting.

-pradeep kanwar
ps: your properties file with a basic prog
*******BasicReadFileProperties.properties**********
log4j.category.sca.kpol=ERROR, HL7_APPENDER_SCA
log4j.additivity.sca.kpol=false
log4j.appender.HL7_APPENDER_SCA=org.apache.log4j.RollingFileAppender
log4j.appender.HL7_APPENDER_SCA.File=hl7_rxrefill_sca.log
log4j.appender.HL7_APPENDER_SCA.MaxFileSize=10KB
log4j.appender.HL7_APPENDER_SCA.MaxBackupIndex=1
log4j.appender.HL7_APPENDER_SCA.layout=org.apache.log4j.PatternLayout
log4j.appender.HL7_APPENDER_SCA.layout.ConversionPattern=%d{ISO8601} %-5p
- %m%n
*****BasicReadFileProperties.java************
import org.apache.log4j.Logger;

import org.apache.log4j.PropertyConfigurator;

/**

* @author pkanwar@secf.com

* Mar 2, 2004

* TODO: put class desc here

*/

public class BasicReadPropertyFile {

public void logTest(){

System.out.println("log testing starts....");


//read properties

PropertyConfigurator.configure("C:\\projects\\lab\\BasicReadPropertyFile.pro
perties");

//create logger instance

//Logger l = Logger.getLogger("BasicReadPropertyFile.class");

Logger l = Logger.getLogger("sca.kpol");


//log data

for(int i=0; i<10000 ;i++){


l.debug("debug");

l.info("info");

l.warn("warn");

l.error("error");

l.fatal("fatal");

}

}

public static void main(String[] args) {

BasicReadPropertyFile brpf = new BasicReadPropertyFile();

brpf.logTest();

}

}

********************

----- Original Message ----- 
From: <Na...@kp.org>
To: <lo...@jakarta.apache.org>
Sent: Tuesday, March 02, 2004 12:58 PM
Subject: Re: Log4j problem with Rolling file appender!


> Hi,
>
> We are currently using log4j-1.2.7 and deployed as a web application in
> WebSphere
> application server. The setting for the Rolling File Appender is
>
> log4j.category.sca.kpol=ERROR, HL7_APPENDER_SCA
> log4j.additivity.sca.kpol=false
> log4j.appender.HL7_APPENDER_SCA=org.apache.log4j.RollingFileAppender
>
log4j.appender.HL7_APPENDER_SCA.File=/logs/kporg/rxrefill/hl7_rxrefill_sca.l
og
> log4j.appender.HL7_APPENDER_SCA.MaxFileSize=100KB
> log4j.appender.HL7_APPENDER_SCA.MaxBackupIndex=1
> log4j.appender.HL7_APPENDER_SCA.layout=org.apache.log4j.PatternLayout
> log4j.appender.HL7_APPENDER_SCA.layout.ConversionPattern=%d{ISO8601} %-5p
> - %m%n
>
> I am getting the following errors with this current setting, with the
> log4j backup file.
>
> 1. Wiping out the backup file: After log4j has taken the backup when the
> size is reached over 100KB, the size of hl7_rxrefill_sca.log.1 is 0KB.
> This is not happening always. But, I can't figure out the reason why it is
> wiping out the contents.
> 2. Another weird behavior. Log4j is updating both the original file and
> back up file simultaneously once the back up has taken.
>
> Appreciate you help.
> Naidu
>
>


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