Hi René,

On Fri, 10 Jun 2022 at 16:36, Schindler, René
<rene.schind...@salt-solutions.de.invalid> wrote:
> Therefore we came up with this workaround:
>
> @PreDestroy
> public static void shutDown() {
>     org.apache.logging.log4j.LogManager.shutdown();
>
>     Configurator.reconfigure(new NullConfiguration());
>     Server.unregisterMBeans();
> }
>
> It prevents the instantiation of the appenders and async loggers and 
> replacing the current config with a NullConfiguration.
> The restart still takes place, but it does not prevent the undeplyoment any 
> more (when getting rid of existing MBeans).
>
> Is there a more elegant solution, maybe getting rid of the restart in the 
> first place?

Can you add more details about your deployment? What application
server are you using?

To find out, which component reinitializes Log4j2, you can run the server with:

-Dlog4j2.debug=true -Dlog4j2.loggerContextStacktraceOnStart=true

which will log a stack trace of the call that initialized the logger context.

Piotr

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Reply via email to