logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Cheshire" <cheshira...@gmail.com>
Subject NPE from DOMConfigurator.configureAndWatch
Date Tue, 07 Nov 2006 22:56:50 GMT
Hi,

I am using log4j 1.2.13 in a web app deployed on SJAS 9. The logging
is initialised in a ServletContextListener subclass in the
contextInitialised method.

        String configFile = context.getInitParameter("log4j.config_file");

        try {
            DOMConfigurator.configureAndWatch(configFile, 30000L);
        }
        catch (Exception ex) {
            throw new RuntimeException("unable to initialise log4j", ex);
        }

This all works fine until I actually change the log4j config file, and
then I see

[#|2006-11-07T12:28:24.284-0800|WARNING|sun-appserver-pe9.0|javax.enterprise.system.stream.err|_ThreadID=49;_ThreadName=Thread-54;_RequestID=8b96aeb3-efe4-4c1b-8b6c-4222c1d99332;|
java.lang.NullPointerException
        at org.apache.log4j.LogManager.getLoggerRepository(LogManager.java:168)
        at org.apache.log4j.xml.XMLWatchdog.doOnChange(DOMConfigurator.java:861)
        at org.apache.log4j.helpers.FileWatchdog.checkAndConfigure(FileWatchdog.java:88)
        at org.apache.log4j.helpers.FileWatchdog.run(FileWatchdog.java:107)
|#]

in the server log, one of these for each appender in the log file.
Logging is subsequently broken and any further attempts yield errors
stating that I am trying to write to a closed appender and I have to
redeploy the web app for it to work again.

How do I fix this?

Thanks

Chris

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