You should also be able to use ClassLoader to find a config file somewhere
on the class path. Here is what I did :

URL configURL =
Log4JConfigurator.class.getClassLoader().getResource(configFile);
PropertyConfigurator.configureAndWatch(configURL.getPath(), delay);

> 
> Hello
> 
> Another newbie question.
> I need to use dynamic property file, that is i need my code 
> to detect the
> changes in log4j.properties and update itself without me 
> restarting it (my
> code must run 24 by 7). With the help from this list i did 
> the following
> 
> static Category category = Category.getInstance(cat_name);
> 
> main ()
> {
> PropertyConfigurator.configureAndWatch("conf/log4j.properties", 1000);
> }
> 
> and it works. Unfortunately, all the property files need to 
> be in the conf
> directory. Since my conf directory is in my classpath,
> Category.getInstance() will find it. But for
> PropertyConfigurator.configureAndWatch() i need to specify 
> the whole path,
> since (by trial and looking in the code) it takes the 
> filename relative to
> the running directory. 
> Is there a way for me to use log4j api and get the whole 
> path, instead of
> hardcoding it, since i want to be very flexible and do not 
> want to recompile
> all the code if location of my property files would change.
> 
> thank you
> boris
> 
> ---------------------------------------------------------------------
> 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