If one is not running inside a web application, what is the proper way to shutdown Log4j2? I only see a noop LogManager.shutdown()
There is no public API for this, but you can use
((LifeCycle) LogManager.getContext()).stop();
If you have an interest in having a public API for this, please vote for or add a comment here: https://issues.apache.org/jira/browse/LOG4J2-124
Update:
In Log4j 2.5 you can call Configurator.shutdown()
. With Log4j 2.6 you can call LogManager.shutdown()
.