AsyncLogger and System.exit() not flushing unless I explicitly call LogManager.shutdown()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

AsyncLogger and System.exit() not flushing unless I explicitly call LogManager.shutdown()

Surendar Chandra
We're using Log4j2 2.12 with AsyncLogger and JsonAppender. If I call System.exit() from uncaught exception handler, sometimes the exception printed before calling System.exit() is not printed on the console. However, if I explicitly call LogManager.shutdown() first, I reliably get the stack trace logged by our code. My impression is that System.exit() should call the shutdown hook which should flush any pending logs? Why do I need to explicitly call LogManager.shutdown(). I don't specify any custom shutdown hooks. Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]