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

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

        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?



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

View raw message