At 01:45 PM 3/18/2005 +0000, you wrote:
>Use the following
>
>URL url = this.getClass().getResource("log4j.properties");
>// Configure the properties and observe the file every 2 seconds
>PropertyConfigurator.configureAndWatch(url.getPath(), 2000);
>

Please avoid configureAndWatch. It uses a non-daemon thread and can cause issues with shutting down classloaders in containers. I would use a dynamic configuration application. If you are using a webapp, try the various configuration servlets out there. There is one in the sandbox, and enhanced version in the wiki, and others listed on Log4j's download page in the 3rd party section. If it is a command line app, then configureAndWatch is probably ok.


Jake

>-----Original Message-----
>From: Elihu Smails [mailto:[EMAIL PROTECTED]
>Sent: 18 March 2005 13:45
>To: [email protected]
>Subject: dynamically reloading log4j config file
>
>Is it possible for Log4J to dynamically reload the configuration file?
> For instance, if I have my configuration set to INFO, and there is a
>problem in my program and want to increase the logging to DEBUG, could
>I change the config file to reflect DEBUG and then call
>PropertyConfigurator.configure( String ) ?
>
>Thank you in advance for the help.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to