logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Multiple instances of log4j2.xml
Date Fri, 17 Jun 2016 13:10:00 GMT
I would probably use tenantName for the context name.

Ralph

> On Jun 17, 2016, at 6:07 AM, Ralph Goers <ralph.goers@dslextreme.com> wrote:
> 
> You would use Configurator.initialize(“MyContextName”, this.getClass().getClassLoader(),
uri);
> 
> The classLoader value can be null.
> 
> Ralph
> 
>> On Jun 17, 2016, at 1:41 AM, Jochen Wiedmann <jochen.wiedmann@gmail.com> wrote:
>> 
>> Hi,
>> 
>> I have an application (more precisely: a war file), which is deployed
>> identically on the same application server. (Think multi temancy),
>> Now, in Log4j 1, I handled that situation quite easily, like this:
>> 
>>   final String uri = tenantName + "/log4j.xml";
>>   final URL url = ClassLoader.getResource(uri);
>>   if (uri == null) {
>>       throw new IllegalStateException("Unable to locate logging
>> configuration: " + uri);
>>   }
>>   DOMConfigurator.configure(url);
>> 
>> Or, in other words: For every tenant, I have a directory for
>> configuration files, including log4j.xml.
>> Simple, quick, and worked absolutely reliable.
>> 
>> But, how do I get this to work with log4j2?
>> 
>> Thanks,
>> 
>> Jochen
>> 
>> -- 
>> The next time you hear: "Don't reinvent the wheel!"
>> 
>> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
>> 
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message