Support for capping archived log files

See gh-15325
This commit is contained in:
Robert Thornton
2018-11-28 17:31:53 -07:00
committed by Stephane Nicoll
parent 6b799da99f
commit 999780f342
7 changed files with 116 additions and 1 deletions

View File

@@ -37,10 +37,13 @@ content into your application. Rather, pick only the properties that you need.
# LOGGING
logging.config= # Location of the logging configuration file. For instance, `classpath:logback.xml` for Logback.
logging.exception-conversion-word=%wEx # Conversion word used when logging exceptions.
logging.file= # Log file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory.
logging.file.max-history=0 # Maximum of archive log files to keep. Only supported with the default logback setup.
logging.file.max-size=10MB # Maximum log file size. Only supported with the default logback setup.
logging.file.name= # Log file name (for instance, `myapp.log`). Names can be an exact location or relative to the current directory.
logging.file.path= # Location of the log file. For instance, `/var/log`.
logging.file.total-size-cap=0 # Places a cap on the total size of log backups. Only supported with the default logback setup.
logging.file.clean-history-on-start=false # Whether to clean the archive log files on startup. Only supported with the default logback setup.
logging.group.*= # Log groups to quickly change multiple loggers at the same time. For instance, `logging.level.db=org.hibernate,org.springframework.jdbc`.
logging.level.*= # Log levels severity mapping. For instance, `logging.level.org.springframework=DEBUG`.
logging.pattern.console= # Appender pattern for output to the console. Supported only with the default Logback setup.

View File

@@ -1738,7 +1738,10 @@ relative to the current directory.
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. Size limits can be changed
using the `logging.file.max-size` property. Previously rotated files are archived
indefinitely unless the `logging.file.max-history` property has been set.
indefinitely unless the `logging.file.max-history` property has been set. The total size
of log archives can be capped using `logging.file.total-size-cap`. When the total size of
log archives exceeds that threshold, backups will be deleted. To force log archive cleanup
on application startup, use the `logging.file.clean-history-on-start` property.
NOTE: The logging system is initialized early in the application lifecycle. Consequently,
logging properties are not found in property files loaded through `@PropertySource`
@@ -1870,6 +1873,16 @@ setup.)
|Maximum number of archive log files to keep (if LOG_FILE enabled). (Only supported with
the default Logback setup.)
|`logging.file.total-size-cap`
|`LOG_FILE_TOTAL_SIZE_CAP`
|The total size of log backups to be kept (if LOG_FILE enabled). (Only supported with
the default Logback setup.)
|`logging.file.clean-history-on-start`
|`LOG_FILE_CLEAN_HISTORY_ON_START`
|Whether to clean the archive log files on startup (if LOG_FILE enabled). (Only supported with
the default Logback setup.)
|`logging.file.path`
|`LOG_PATH`
|If defined, it is used in the default log configuration.