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: Changing xml config file after startup
Date Tue, 14 Aug 2018 16:22:39 GMT
You don’t need to call ctx.updateLoggers(). That is done already inside the ctx.reconfigure().

In short, you could shorten that to one line

((org.apache.logging.log4j.core.LoggerContext) LogManager.getContext(false)).reconfigure();

That could certainly be added to the Configurator class as 

Configurator.reconfigure();

If that is what you want please create a Jira issue and summarize this there.

Ralph

> On Aug 14, 2018, at 9:14 AM, Ralph Goers <ralph.goers@dslextreme.com> wrote:
> 
> You are simply trying to refresh the configuration from the same location?
> 
> Ralph
> 
>> On Aug 14, 2018, at 8:35 AM, John Lussmyer <Cougar@CasaDelGato.com> wrote:
>> 
>> Our (old) code that uses log4j does the following in order to swap xml configurations
after app initialization. 
>> 
>> 		final org.apache.logging.log4j.core.LoggerContext ctx = (org.apache.logging.log4j.core.LoggerContext)
LogManager.getContext(false);
>> 		ctx.reconfigure();
>> 		ctx.updateLoggers();
>> 
>> Is there a new supported way of doing the same thing?  (The above really seems kind
of hacky.)
>> 
>> 
>> ---------------------------------------------------------------------
>> 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
> 
> 



---------------------------------------------------------------------
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