Hello Scott,
How exactly would that work? Doesn't configureAndWatch() require a
full file path? url.getFile() only returns the filename part of the
URL. How does configureAndWatch() know where to find this file? Am I
missing something?
Jake
Wednesday, June 12, 2002, 3:44:48 PM, you wrote:
SM> Rather than hacking Log4J's source, here's how I accomplished it :
SM> 1. Create a custom LoggerConfigurator, "MyConfigurator", extending
SM> PropertyConfigurator
SM> 2. Set the properties file to use this configurator.
SM> ...
SM> public class MyLoggerConfigurator extends PropertyConfigurator {
SM> private static final int POLLING_DELAY = 5000;
SM> /**
SM> * overrides the PropertyConfigurator's implementation of
SM> * the Configurator interface's doConfigure(URL, LoggerRepository)
SM> * method.
SM> *
SM> * Be advised that this method takes the URL and grabs the file off
SM> * the end... meaning it really only works with file URLs. This is
SM> * because of the definition of the Configurator interface, and was
SM> * the only way to make this work without hacking the Log4J source
SM> * (LogManager's static initializer and some other stuff?).
SM> *
SM> * The Configurator interface and configureAndWatch FileWatchdog
SM> * facilities will be cleaner in future versions of Log4J, according
SM> to
SM> * recent traffic on [EMAIL PROTECTED], though.
SM> */
SM> public void doConfigure(URL url, LoggerRepository repository) {
SM> configureAndWatch(url.getFile(), POLLING_DELAY);
SM> }
SM> }
SM> ...
SM> Regards,
SM> Scott
SM> -----Original Message-----
SM> From: Bomb Diggy [mailto:[EMAIL PROTECTED]]
SM> Sent: Wednesday, June 12, 2002 4:09 PM
SM> To: [EMAIL PROTECTED]
SM> Subject: Re: Re-read configuration file via configureAndWatch()
SM> There was a post a couple of months ago about being
SM> able to 'set' configureAndWatch() via the
SM> log4j.properties file.
SM> http://www.mail-archive.com/[email protected]/msg04352.html
SM> Is this feature planned for future releases of Log4J?
SM> I hacked on the source a little and managed to get it
SM> working. Totally cool, but my hack is just that.
SM> Log4J now automatically finds my log4j.properties file
SM> (in the Tomcat classpath) and tells itself to reload
SM> every 60 seconds.
SM> The code snippet is at:
SM> http://www.acromedia.com/PCUpdate.html
SM> __________________________________________________
SM> Do You Yahoo!?
SM> Yahoo! - Official partner of 2002 FIFA World Cup
SM> http://fifaworldcup.yahoo.com
SM> --
SM> To unsubscribe, e-mail:
SM> <mailto:[EMAIL PROTECTED]>
SM> For additional commands, e-mail:
SM> <mailto:[EMAIL PROTECTED]>
SM> --
SM> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
SM> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
Best regards,
Jacob mailto:[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>