Re: LogManager.resetConfiguration in log4j2

2017-03-15 Thread Ralph Goers
Just use Configurator.initialize(new DefaultConfiguration()); Ralph > On Mar 15, 2017, at 9:09 AM, kriegerd wrote: > > I'm seeing that LoggerContext.setConfiguration is private and is being used > by start(Configuration) or onChange(Reconfigurable). > > Would using start work? I check the star

Re: LogManager.resetConfiguration in log4j2

2017-03-15 Thread kriegerd
I'm seeing that LoggerContext.setConfiguration is private and is being used by start(Configuration) or onChange(Reconfigurable). Would using start work? I check the start method, and it seems it's ok to use, but just wondering if anyone had any info about it. Thanks again. Alejandro. On Wed, Ma

Re: LogManager.resetConfiguration in log4j2

2017-03-15 Thread kriegerd
Thanks a lot for the help. I'll try it today. Alejandro. On Tue, Mar 14, 2017 at 10:34 PM Ralph Goers wrote: > Actually, the equivalent would be set the configuration back to the > DefaultConfiguratoin, not a null configuration. > > Ralph > > > On Mar 14, 2017, at 9:09 PM, Matt Sicker wrote: >

Re: LogManager.resetConfiguration in log4j2

2017-03-15 Thread Matt Sicker
Looking at the source code for resetConfiguration, it says it clears out all appenders and levels and whatnot. I suppose depending on the goals, yes, DefaultConfiguration makes more sense usually unless you're trying to disable logging while you manually configure things in some strange way. On 15

Re: LogManager.resetConfiguration in log4j2

2017-03-14 Thread Ralph Goers
Actually, the equivalent would be set the configuration back to the DefaultConfiguratoin, not a null configuration. Ralph > On Mar 14, 2017, at 9:09 PM, Matt Sicker wrote: > > After looking at the source code for Hierarchy::resetConfiguration(), I see > that there's no specific analog in 2.x.

Re: LogManager.resetConfiguration in log4j2

2017-03-14 Thread Matt Sicker
After looking at the source code for Hierarchy::resetConfiguration(), I see that there's no specific analog in 2.x. However, the following snippet should do about the same thing: LoggerContext ctx = LoggerContext.getContext(false); ctx.setConfiguration(new NullConfiguration()); On 14 March 2017

Re: LogManager.resetConfiguration in log4j2

2017-03-14 Thread Matt Sicker
I'm not exactly sure what that's supposed to do, but if you cast the LoggerContext from LogManager.getContext() to the implementation class in log4j-core, there's a reconfigure() method. https://logging.apache.org/log4j/2.x/log4j-core/apidocs/org/apache/logging/log4j/core/LoggerContext.html On 14