You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "ssjin@libero.it" <ss...@libero.it> on 2007/09/22 11:29:34 UTC

Inhibit PropertyConfigurator.configure(...) method usage.

Hi,
I have a main application and other ones running on the same WebSphere server. I use PropertyConfigurator.configure(...) to read my properties file when starting main application, but i don't want someone else using the same method after that to reset the configuration loading another properties file.
Is there some way to do this? Only way i can think of is declaring a static boolean and setting it to true when invoking a static method such like "freezeConfiguration()" and then enclose doConfigure() and configureAndWatch() methods in a if block (such like 'if (!frozenConf) ... ').
This way should be fine, but I should patch the library.
Any hint?
Thank you in advice.

Giorgio


------------------------------------------------------
Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
http://i-mode.wind.it/


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: Inhibit PropertyConfigurator.configure(...) method usage.

Posted by Jacob Kjome <ho...@visi.com>.
Are you talking about rogue library code within 
one application performing configuration more 
than once (or at all, since library code has no 
business performing configuration or supplying 
log4j configuration files in the classpath) or 
are you talking about multiple apps using a 
single logger repository, with Log4j.jar being 
shared as a global library where each app stomps 
on the other's configuration at startup?

I'll cut to the chase.  There's nothing in Log4j 
that prevents reconfiguration on 
demand.  However, in the former case, library 
code should not be performing configuration.  If 
it is, please scold the library developer 
profusely and get them to see the error in their 
ways.  The latter case is more a matter of using 
a repository selector.  They allow a global 
shared log4j.jar instance to support multiple 
logger repositories.  By default Log4j uses a 
single logger repository for all 
logging.  However, if you install a repository 
selector, you can use some criteria, such as 
Classloader or JNDI to distinguish between 
applications, allowing for each to have its own 
logger repository.  Please search the list 
archives or a search engine for information on 
repository selectors and email the list if you have further questions.

Jake

At 04:29 AM 9/22/2007, you wrote:
 >Hi,
 >I have a main application and other ones running on the same WebSphere
 >server. I use PropertyConfigurator.configure(...) to read my
 >properties file when starting main application, but i don't want
 >someone else using the same method after that to reset the
 >configuration loading another properties file.
 >Is there some way to do this? Only way i can think of is declaring a
 >static boolean and setting it to true when invoking a static method
 >such like "freezeConfiguration()" and then enclose doConfigure() and
 >configureAndWatch() methods in a if block (such 
like 'if (!frozenConf) ... ').
 >This way should be fine, but I should patch the library.
 >Any hint?
 >Thank you in advice.
 >
 >Giorgio
 >
 >
 >------------------------------------------------------
 >Leggi GRATIS le tue mail con il telefonino i-mode™ di Wind
 >http://i-mode.wind.it/
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-user-help@logging.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org