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 <ralph.go...@dslextreme.com> 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 <boa...@gmail.com> 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 <boa...@gmail.com> 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 <krieg...@gmail.com> 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 <boa...@gmail.com>
> >>
> >
> >
> >
> > --
> > Matt Sicker <boa...@gmail.com>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


-- 
Matt Sicker <boa...@gmail.com>

Reply via email to