PavelTurk commented on issue #2007: URL: https://github.com/apache/logging-log4j2/issues/2007#issuecomment-1827604779
@ppkarwasz , thank you very much for your answer. What you suggest is not a solution for me. I need to use my own shutdownHook in my application. This shutdownHook must do some logic to close application correctly AND only in the very end I can shutdown `log4j2`. So, I need to set `log4j2.shutdownHookEnabled` to `false` because otherwise `log4j2` can easily stop BEFORE my shutdownHook completes. From javadoc: > A shutdown hook is simply an initialized but unstarted thread. When the virtual machine begins its shutdown sequence it will start all registered shutdown hooks in some unspecified order and let them run concurrently. When all the hooks have finished it will then halt. Note that daemon threads will continue to run during the shutdown sequence, as will non-daemon threads if shutdown was initiated by invoking the [exit](https://docs.oracle.com/javase/8/docs/api/java/lang/Runtime.html#exit-int-) method. If I understand everything correctly we have two types of application that uses `log4j2`. The first ones doesn't have own `shutdownHooks` the second ones have. So, for the second type applications `log4j2.shutdownHookEnabled` must be set to `false`. And `log4j2` must support this type of applications. I still think that this is a bug in `log4j2`. It doesn't matter what java version is used - there is always possibility that JRE will log some messages after `LogManager.shutdown()`, so `log4j2` should support such cases. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
