-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Custom LoggingSystemShutdownHook to initiate/wait for applicationContext.close() #4755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ation context shutdown before proceeding with the actual stop of the logging system.
@brenuart The Travis build failed for this change. Could you please address the formatting and javadoc problems reported by checkstyle:
|
I think we're in danger of building a house of cards if we pursue the shutdown-hook-based approach. As I said in my comment on 4681, the logging system is now only cleaned up as a result of the root context being closed. This is our preferred approach for shutting down the logging system and should be used in preference to a logging system shutdown hook. |
LoggingApplicationListener
registers its own shutdown hook (if so configured) and delegates to the handler provided by theLoggingSystem
. The registered hook closes the application context before stopping the logging system.The implementation should ideally consult the
SpringApplication
to detect if it is configured to register its own hook or not. Unfortunately this information is not available.Maybe a cleaner solution is for the
SpringApplication
to allow for registration of additional hooks that would be invoked after its own. Something like a sequence of hooks, possibly ordered, where theSpringApplication
would register its own with higher precedence if so configured. That composite hook would always be registered.See #4681