logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "shadowitsilver-log4j@yahoo.it" <shadowitsilver-lo...@yahoo.it>
Subject Re: Configuration file location programmatically
Date Fri, 08 Mar 2013 11:42:51 GMT

----- Messaggio originale -----
> Da: Ralph Goers <ralph.goers@dslextreme.com>
> A: Log4J Users List <log4j-user@logging.apache.org>
> Cc: 
> Inviato: Giovedì 7 Marzo 2013 19:00
> Oggetto: Re: Configuration file location programmatically
> In Log4j 2 it is the LoggerContext that is configured.  You can cause the 
> LoggerContext to pick up its configuration in one of a couple of ways:
> 1. Set the "log4j.configurationFile" system property before calling 
> Log4j.  This will allow you to have a default or single configuration.
> 2. Use one of the Configurator.initialize() methods. Note that the ClassLoader 
> is important in Log4j 2. If you use the ClassLoaderContextSelector (the default) 
> it will create LoggerContexts associated with the ClassLoader from which classes 
> are calling LogManager.getLogger().  So if you are running in an application 
> server where it has its own ClassLoader and each application has its own then 
> you can use Configurator.initialize to create LoggerContexts for each of those 
> ClassLoaders and have each have their own configuration.
> Ralph

Thanks Ralph, i'm using the second way.
Claudio Papa

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

View raw message