You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Deprecate and provide alternatives for logging properties that are
specific to Logback.
The following Spring Boot properties have been changed:
* logging.pattern.rolling-file-name ->
logging.logback.rollingpolicy.file-name-pattern
* logging.file.clean-history-on-start ->
logging.logback.rollingpolicy.clean-history-on-start
* logging.file.max-size ->
logging.logback.rollingpolicy.max-file-size
* logging.file.total-size-cap ->
logging.logback.rollingpolicy.total-size-cap
* logging.file.max-history ->
logging.logback.rollingpolicy.max-history
As have the system environment properties that they map to:
* ROLLING_FILE_NAME_PATTERN ->
LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN
* LOG_FILE_CLEAN_HISTORY_ON_START ->
LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START
* LOG_FILE_MAX_SIZE ->
LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE
* LOG_FILE_TOTAL_SIZE_CAP ->
LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP
* LOG_FILE_MAX_HISTORY ->
LOGBACK_ROLLINGPOLICY_MAX_HISTORY
This commit also cleans up and simplifies `DefaultLogbackConfiguration`.
Closesgh-23609
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot-docs/src/docs/asciidoc/spring-boot-features.adoc
+55-34Lines changed: 55 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -2040,17 +2040,40 @@ The following table shows how the `logging.*` properties can be used together:
2040
2040
|===
2041
2041
2042
2042
Log files rotate when they reach 10 MB and, as with console output, `ERROR`-level, `WARN`-level, and `INFO`-level messages are logged by default.
2043
-
Size limits can be changed using the configprop:logging.file.max-size[] property.
2044
-
Rotated log files of the last 7 days are kept by default unless the configprop:logging.file.max-history[] property has been set.
2045
-
The total size of log archives can be capped using configprop:logging.file.total-size-cap[].
2046
-
When the total size of log archives exceeds that threshold, backups will be deleted.
2047
-
To force log archive cleanup on application startup, use the configprop:logging.file.clean-history-on-start[] property.
2048
2043
2049
2044
TIP: Logging properties are independent of the actual logging infrastructure.
2050
2045
As a result, specific configuration keys (such as `logback.configurationFile` for Logback) are not managed by spring Boot.
2051
2046
2052
2047
2053
2048
2049
+
[[boot-features-logging-file-rotation]]
2050
+
=== File Rotation
2051
+
If you are using the Logback, it's possible to fine-tune log rotation settings using your `application.properties` or `application.yaml` file.
2052
+
For all other logging system, you'll need to configure rotation settings directly yourself (for example, if you use Log4J2 then you could add a `log4j.xml` file).
2053
+
2054
+
The following rotation policy properties are supported:
| The number of days to keep log archives (defaults to 7)
2073
+
|===
2074
+
2075
+
2076
+
2054
2077
[[boot-features-custom-log-levels]]
2055
2078
=== Log Levels
2056
2079
All the supported logging systems can have the logger levels set in the Spring `Environment` (for example, in `application.properties`) by using `+logging.level.<logger-name>=<level>+` where `level` is one of TRACE, DEBUG, INFO, WARN, ERROR, FATAL, or OFF.
@@ -2165,64 +2188,62 @@ To help with the customization, some other properties are transferred from the S
2165
2188
| `LOG_EXCEPTION_CONVERSION_WORD`
2166
2189
| The conversion word used when logging exceptions.
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/logging/LoggingApplicationListener.java
Copy file name to clipboardExpand all lines: spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/LoggingSystemProperties.java
+52-28Lines changed: 52 additions & 28 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
/*
2
-
* Copyright 2012-2019 the original author or authors.
2
+
* Copyright 2012-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -62,30 +62,51 @@ public class LoggingSystemProperties {
0 commit comments