logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kristina Marasovic <Kristina.Maraso...@cern.ch>
Subject Problems using RollingFileAppender
Date Thu, 12 May 2005 12:50:34 GMT
Hello there,

I have encountered a problem using RollingFileAppender class on my SuSE Linux 
PC - my log file "testLogging.log" (appender named "A1") cannot be created.

I have downloaded the latest version of Chainsaw - Chainsaw v2 which contains 
the log4j-1.3alpha-7.jar package, and also included that jar package in the 
CLASSPATH so that logging methods can find the needed classes.

When I run "TestLogging" program from the command line (created just for 
testing a log message) using "log4j.properties" for configuring Log4j, 
following message with reported error appear:

-------------------------------------------------------------------------
~/log4j_proba> java TestLogging
*** configurationOptionStr=log4j.properties
log4j:INFO Using URL [file:/users/kim/log4j_proba/log4j.properties] for 
automatic log4j configuration of repository named [default].
...
log4j:INFO Returning existing logger [org.apache.log4j] in repository 
[default].
Reported error: "Could not instantiate appender named "A1"."
** End of LogManager static initializer
-----------------------------------------------------------------------


Following are the contents of the files: "TestLogging.java" and 
"log4j.properties".

I have also noticed that the path of the RollingFileAppender.class in the 
log4j-1.3alpha-7.jar is
	org/apache/log4j/rolling/RollingFileAppender.class
while according to the API it must be a part of the org.apache.log4j package. 
So when I replace org.apache.log4j package with org.apache.log4j.rolling in 
"log4j.properties" there are no error reports, but still, no log file is 
created. Any hint as to what I am doing wrong will be most welcome.


TestLogging.java:
---------------------------------------
import org.apache.log4j.*;
public class TestLogging {
    static Logger logger = Logger.getLogger(TestLogging.class.getName());

    public static void main(String args[]) {
        logger.debug("Start of main()");
        logger.info("Just testing a log message with priority set to INFO");
        logger.warn("Just testing a log message with priority set to WARN");
        logger.error("Just testing a log message with priority set to ERROR");
        logger.fatal("Just testing a log message with priority set to FATAL");
    }
}
---------------------------------------



log4j.properties:
-----------------------------------------
log4j.logger.TestLogging=ERROR, A1

log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.File=testLogging.log
log4j.appender.A1.MaxFileSize=100KB
log4j.appender.A1.MaxBackupIndex=1
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-5p [%t]: %c - %m%n
-------------------------------------------



---------------------------------------------------------------------
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