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 March 2017 at 00:34, Ralph Goers <[email protected]> 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 <[email protected]> wrote: > > > > 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 at 22:28, Matt Sicker <[email protected]> wrote: > > > >> 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 March 2017 at 20:53, kriegerd <[email protected]> wrote: > >> > >>> Hi, > >>> > >>> Is there a way to emulate the behavior of > LogManager.resetConfiguration in > >>> log4j2? > >>> > >>> We need to migrate the functionality of an older class that uses it. > >>> Thanks! > >>> > >>> Alejandro. > >>> > >> > >> > >> > >> -- > >> Matt Sicker <[email protected]> > >> > > > > > > > > -- > > Matt Sicker <[email protected]> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Matt Sicker <[email protected]>
