logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rich Livingstone <nab...@bananasoft.net>
Subject Hot change thread safety problem
Date Tue, 26 Sep 2006 10:39:17 GMT

I am using Log4J inside Tomcat, which works fine apart from when I try and
set a hot change watcher. I then get thread problems which manifest as null
pointer exceptions in access to other class static members which are
actually synchronized. 

I've tried using this code in Log4j 1.2:

	static {
	    PropertyConfigurator.configureAndWatch("log4j.properties",10000);
	}

and this in Log4j 1.3 alpha 8:

	static {
		FileWatchdog watchdog = new FileWatchdog();
	    watchdog.setFile("../webapps/ui/WEB-INF/classes/log4j.properties");
	    watchdog.setInterval(10000);
	    watchdog.setConfigurator(PropertyConfigurator.class.getName());
	    ((LoggerRepositoryEx)
LogManager.getLoggerRepository()).getPluginRegistry().addPlugin(watchdog);
	    watchdog.activateOptions();		
	}

Does anyone know:

 - is this supposed to be thread-safe
- if so, am I making the correct calls to make this work

Sometimes this works ok (presumably when I change the log4j.properties file
during the 10 seconds when the hot change watcher isn't looking) and
sometimes not.

It would be very useful to be able to make this work as in my production
environment I would like to switch certain stats messages on and off at will
-- 
View this message in context: http://www.nabble.com/Hot-change-thread-safety-problem-tf2337584.html#a6504359
Sent from the Log4j - Users mailing list archive at Nabble.com.


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