Add opt-in support for registering a shutdown hook to shut down logging

This commit adds a new property, logging.register-shutdown-hook, that
when set to true, will cause LoggingApplicationListener to register
a shutdown hook the first time it initializes a logging system. When
the JVM exits, the shutdown hook shuts down each of the supported
logging systems, ensuring that all of their appenders have been
flushed and closed.

Closes gh-4026
This commit is contained in:
Andy Wilkinson
2015-10-08 15:25:06 +01:00
parent 4594edf4c4
commit 36d4246289
9 changed files with 162 additions and 1 deletions

View File

@@ -65,6 +65,7 @@ content into your application; rather pick only the properties that you need.
logging.pattern.console= # appender pattern for output to the console (only supported with the default logback setup)
logging.pattern.file= # appender pattern for output to the file (only supported with the default logback setup)
logging.pattern.level= # appender pattern for the log level (default %5p, only supported with the default logback setup)
logging.register-shutdown-hook=false # register a shutdown hook for the logging system when it is initialized
# IDENTITY ({sc-spring-boot}/context/ContextIdApplicationContextInitializer.{sc-ext}[ContextIdApplicationContextInitializer])
spring.application.name=