Skip to content

Commit

Permalink
Merge branch '2.3.x' into 2.4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jan 29, 2021
2 parents ca9b612 + c03d877 commit 2d05652
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2215,6 +2215,26 @@ Spring Boot includes the following pre-defined logging groups that can be used o



[[boot-features-custom-log-configuration]]
=== Using a Log Shutdown Hook
In order to release logging resources it is usually a good idea to stop the logging system when your application terminates.
Unfortunately, there's no single way to do this that will work with all application types.
If your application has complex context hierarchies or is deployed as a war file, you'll need to investigate the options provided directly by the underlying logging system.
For example, Logback offers http://logback.qos.ch/manual/loggingSeparation.html[context selectors] which allow each Logger to be created in its own context.

For simple "single jar" applications deployed in their own JVM, you can use the `logging.register-shutdown-hook` property.
Setting `logging.register-shutdown-hook` to `true` will register a shutdown hook that will trigger log system cleanup when the JVM exits.

You can set the property in your `application.properties` or `application.yaml` file:

[source,yaml,indent=0,configprops,configblocks]
----
logging:
register-shutdown-hook: true
----



[[boot-features-custom-log-configuration]]
=== Custom Log Configuration
The various logging systems can be activated by including the appropriate libraries on the classpath and can be further customized by providing a suitable configuration file in the root of the classpath or in a location specified by the following Spring `Environment` property: configprop:logging.config[].
Expand Down

0 comments on commit 2d05652

Please sign in to comment.