logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robin Clarke <junk.ro...@googlemail.com>
Subject Unable to write logs out to FileAppenders or RollingFileAppenders
Date Wed, 07 Dec 2005 13:28:48 GMT
Hi,

 I cannot seem to get any logging data written to file type appenders
(FileAppener and RollingFileAppender) and am hoping someone can point
out what I am doing wrong.

 I seem to be able to manage what is logged to stdout without any
problems. The files do get created, but nothing is ever written to
them.

 I am using Tomcat 5.5.9 with JDK 1.4.2.

 Any help would be appreciated.

 Thanks
robin

log4j.properties
-----------------------------------------------------------------
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1.File=robin.log
log4j.appender.A1.Append=true
log4j.appender.A1.ImmediateFlush=true
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p: %m%n

log4j.appender.A2=org.apache.log4j.RollingFileAppender
log4j.appender.A2.File=robin_rolling.log
log4j.appender.A2.MaxFileSize=100KB
log4j.appender.A2.MaxBackupIndex=1
log4j.appender.A2.layout=org.apache.log4j.PatternLayout
log4j.appender.A2.layout.ConversionPattern=%p %t %c - %m%n

log4j.rootLogger=warn, A2

log4j.logger.com.ia=debug, A1
#log4j.logger.com.ia=debug, A2

log4j.logger.org.hibernate=info, A2
-----------------------------------------------------------------

My java class looks something like this:

-----------------------------------------------------------------
package com.ia.actions;

import org.apache.log4j.Logger;
/* other import statements */

public class HomeAction extends Action {

    private static Logger log = Logger.getLogger(HomeAction.class.getName());

    public ActionForward foo() {

        log.debug("This is a logging statement.");

    }
}
-----------------------------------------------------------------

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


Mime
View raw message