Add support for configuring Log4j2 rolling policy properties via application.properties, similar to Logback.#48876
Closed
timonin01 wants to merge 1 commit intospring-projects:mainfrom
Closed
Conversation
This commit adds support for configuring Log4j2 rolling policy properties (file-name-pattern, max-file-size, total-size-cap, max-history) through application.properties, similar to how it's done for Logback. - Add Log4J2RollingPolicySystemProperty enum defining rolling policy system properties - Add Log4J2LoggingSystemProperties class extending LoggingSystemProperties to apply rolling policy properties from environment - Update log4j2-file.xml to use system properties instead of hardcoded values for rolling policy configuration - Add Log4J2LoggingSystemPropertiesTests to verify rolling policy properties are correctly applied Closes spring-projectsgh-46468 Signed-off-by: Timonin Andrey <atimonin2006@gmail.com>
Member
|
Thanks but we already have a comprehensive PR that is being worked on for quite a while, see #47260 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for configuring Log4j2 rolling policy properties via
application.properties, similar to Logback.Changes
Log4J2RollingPolicySystemPropertyenum for rolling policy system propertiesLog4J2LoggingSystemPropertiesclass to apply rolling policy propertieslog4j2-file.xmlto use system properties for rolling policy configurationProperties Added
The following properties are now supported:
logging.log4j2.rollingpolicy.file-name-pattern- Pattern for rolled-over log fileslogging.log4j2.rollingpolicy.max-file-size- Maximum size of a single log filelogging.log4j2.rollingpolicy.total-size-cap- Total size cap for all log backupslogging.log4j2.rollingpolicy.max-history- Maximum number of log files to keepExample Usage
logging.log4j2.rollingpolicy.max-file-size=20MBlogging.log4j2.rollingpolicy.max-history=10logging.log4j2.rollingpolicy.total-size-cap=100MBRelated Issues
Closes #48323