In your app, you can execute
System.out.println(getClass().getResource("/log4j2.xml"));
(assuming that the config file is in the classpath).

Also, if you set <Configuration status="trace" ...
in your log4j2 config file it will print the location of the config file that 
is used. 

Sent from my iPhone

> On 2014/08/12, at 1:24, Arwen Pond <[email protected]> wrote:
> 
> B calls A without setting a new process and passes the logger object to A.  
> It seems to me that both files will be on the classpath (lib directory).  How 
> do I know which one it will find first?
> 
> -----Original Message-----
> From: Remko Popma [mailto:[email protected]] 
> Sent: Friday, August 08, 2014 5:58 PM
> To: Log4J Users List
> Subject: Re: Multiple configuration files?
> 
> Do applications A and B run in separate processes, or does B call some 
> function in A without starting a new process for A? 
> 
> Log4j initializes only once in a given process. If A and B are in separate 
> processes they can have separate configurations. If they run in the same 
> process, they'll share a config. Which config file is used depends on your 
> classpath and system properties when you started that process. 
> 
> Sent from my iPhone
> 
>> On 2014/08/09, at 3:28, Arwen Pond <[email protected]> wrote:
>> 
>> I have multiple applications that use log4j.  Some depend on others.  For 
>> example application A can be run independently and has a log4j config file 
>> under src/main/resources/log4j2.xml.  Application B invokes application A 
>> but it has a different log4j config file in its resource directory.
>> 
>> When there are multiple  log4j2.xml files in the path how are they 
>> used/found?  Are they additive?  Does it just use the first one it finds?
>> 
>> Thanks,
>> Arwen
>> 
>> 
>> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to