Lemme show you how I do it:
// This is the base of our application
appRoot =
ApplicationListener.getServletContext().getRealPath("/");
// user.dir is the directory from which javaw was invoked
// and we want it to be /WEB-INF/../
// This is used by log4j
System.setProperty("user.dir",appRoot);
// configure log4j
String fileName = appRoot + "/WEB-INF/log4j.xml";
// This will enable automatic reloading of log4j configuration
file.
DOMConfigurator.configureAndWatch(fileName,2000);
This works perfect for me.
> -----Original Message-----
> From: Prasad, Kamakshya [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 29, 2004 12:25 AM
> To: Log4J Users List
> Subject: RE: Reloading the properties file
>
> Hi,
>
> No I have not implemented any configurator. Currently on application
> start-up it gets loaded from the web-inf/classes.
> What we were thinking that after application has started up something
> changes then how to configure.
> If we call only configure and not configurewatch then will it be fine.
> The system admin when changes the file he has to reload the file in the
> memory by manually clicking on the button.
>
> KP
>
> -----Original Message-----
> From: Ivan Jouikov [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, September 29, 2004 4:17 PM
> To: 'Log4J Users List'
> Subject: RE: Reloading the properties file
>
> Writing a servlet to call configure and watch?
>
> When you configure log4j using DOMConfigurator, and use
> configureAndWatch, it automatically reloads that file when it changes.
> You don't need to invoke anything.
>
> > -----Original Message-----
> > From: Prasad, Kamakshya [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, September 28, 2004 11:27 PM
> > To: [EMAIL PROTECTED]
> > Subject: Reloading the properties file
> >
> > Hi All,
> >
> >
> >
> > We have a j2ee web application using log4j for logging purpose.
> Nowadays
> > quite frequently we have to switch on and switch off the debugging
> > mechanism.
> >
> > The properties file is in web-inf/classes.
> >
> > We have to load the configuration file whenever it changes.
> >
> > We are planning to write a servlet which calls the
> PropertyConfigurator
> > configureAndWatch method to reload the properties file.
> >
> > But we just read through the log4j faq that this is unsafe.
> >
> > Please advice me the best way to implement this reloading mechanism.
> >
> >
> >
> > KP
> >
> >
> > ---
> > Incoming mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
> >
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
>
>
>
> ---------------------------------------------------------------------
> 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]
>
> ---
> Incoming mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.766 / Virus Database: 513 - Release Date: 17.09.2004
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]