tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Lacson <plac...@gmail.com>
Subject Re: reload log4j.properties on-the-fly?
Date Thu, 20 Jan 2005 23:34:06 GMT
Andy,

Try the following to enable the log4j watchdog:

    public static void configure(final String configFile, final long 
delay, final Logger logger) {
        PropertyConfigurator.configureAndWatch(configFile,delay);
        FileWatchdog watcher = new FileWatchdog(configFile) {
            public void doOnChange() {
                new PropertyConfigurator().doConfigure(
                    filename, LogManager.getLoggerRepository()
                );
                if (logger != null) {
                    logger.info("Re-read configuration file " + filename);
                }
            }
        };
       
        watcher.setDelay(delay);
        watcher.start();
    }


Andy Kriger wrote:

>I am running Tomcat 5.5 with log4j logging (log4j.properties in common/classes).
>
>Is it possible to make changes to the log4j properties and have the
>changes reloaded on-the-fly instead of having to restart Tomcat in
>order to pick up changes? This would be very useful for those times
>debug level logging or specific class logging is needed where
>generally that level of logging is not required.
>
>thx
>andy
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>  
>


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


Mime
View raw message