I used to use the configureAndWatch() method in my webapps, but I advise against it now. The watchdog classes currently have no lifecycle control. LogManager.shutdown() will *not* end the thread that the watchdog uses. If you try to reload your servlet context, the thread will continue to reference the old webapp class loader. Log4j-1.3. should have better options than configureAndWatch(). I would suggest not doing anything to the dtd or DOMConfigurator to provide special support for configureAndWatch(). It will probably be either deprecated or implemented differently later.


That said, if you still want to use configureAndWatch(), you can use the InitContextListener() from log4j-sandbox to provide information to your webapp as to where your configuration file is. There are other options as well, but I'll let you read about those. As for dealing with a non-servlet environment, this is actually less problematic since it probably is the only app running under the JVM, unlike a container environment where lots of apps and lots of class loaders are running. I would just provide configuration option for your standalone app to be able to specify where the log4j.xml file exists. Shouldn't be hard to write. And you'll have to do initialization yourself instead of counting on default initialization.

Jake

At 03:48 PM 8/27/2003 -0700, you wrote:
Hello,

I was planning on using the FileWatchdog class (via DOMConfigurator) to cause my log4j.xml file to be reloaded whenever it is changed, avoiding having to bounce the webapp during debug. My problem is that I rely on the default initialization mechanism in log4j to find the file, so I don't have the filename. I'm currently looking at modifying the dtd to add a "watch" option so the DOMConfigurator can setup the watchdog during init.

Is there a better way to do this?? I'm building a package for use by our web-apps and standalone-apps, so I need something that works well in both environments. Any thoughts??

--- regards ---
Larry


-------------------------- Larry Young The Dalmatian Group www.dalmatian.com


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