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


On Mar 7, 2013, at 2:37 AM, [email protected] wrote:

> Hello to everyone, 
> i need to specify the location of the configuration file (log4j2) 
> programmatically. I've searched all around the web but i've not found a 
> solution.
> Thanks in advance.
> Claudio Papa
> 
> ---------------------------------------------------------------------
> 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