Skip to content

Add clean-history-on-start and total-size-cap rolling policy properties for Log4J2 - #51153

Closed
elephant-y wants to merge 2 commits into
spring-projects:mainfrom
elephant-y:gh-46468-log4j2-rolling-policy
Closed

Add clean-history-on-start and total-size-cap rolling policy properties for Log4J2#51153
elephant-y wants to merge 2 commits into
spring-projects:mainfrom
elephant-y:gh-46468-log4j2-rolling-policy

Conversation

@elephant-y

Copy link
Copy Markdown

No description provided.

…es for Log4j2

Add CLEAN_HISTORY_ON_START and TOTAL_SIZE_CAP to Log4j2's
RollingPolicySystemProperty enum so that log4j2 users can configure
these rolling policy settings via application properties, matching the
existing support in logback's RollingPolicySystemProperty.

See spring-projectsgh-46468

Signed-off-by: yangzhice <a13644015167@qq.com>
@elephant-y
elephant-y force-pushed the gh-46468-log4j2-rolling-policy branch from 7e1fd78 to 688f494 Compare July 29, 2026 14:34
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jul 29, 2026
@snicoll snicoll changed the title Gh 46468 log4j2 rolling policy Add rolling policy properties for log4j2 configuration Jul 29, 2026
@snicoll

snicoll commented Jul 29, 2026

Copy link
Copy Markdown
Member

Thanks for the PR but those should be tested if possible. Look at Log4J2LoggingSystemTests and add the missing tests.

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Jul 29, 2026
@snicoll snicoll changed the title Add rolling policy properties for log4j2 configuration Add clean-history-on-start and total-size-cap rolling policy properties for Log4J2 Jul 29, 2026
@elephant-y

elephant-y commented Jul 30, 2026

Copy link
Copy Markdown
Author

Thanks for the PR but those should be tested if possible. Look at Log4J2LoggingSystemTests and add the missing tests.

Thanks for the review! I've added assertions for both CLEAN_HISTORY_ON_START and TOTAL_SIZE_CAP to the rollingPolicySystemPropertiesAreApplied test in Log4J2LoggingSystemTests. I also aligned CLEAN_HISTORY_ON_START to use String type (matching logback's approach) since the system property value is resolved as a string. Let me know if there's anything else to address.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 30, 2026
@snicoll snicoll self-assigned this Aug 24, 2026
@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged status: feedback-provided Feedback has been provided labels Aug 24, 2026
@snicoll snicoll added this to the 4.2.0-M2 milestone Aug 24, 2026
@snicoll

snicoll commented Aug 24, 2026

Copy link
Copy Markdown
Member

This PR only sets two system properties but these are not used anywhere. I have some code in the meantime that sort of implement what is expected but this makes log4j2-file.xml more complex than I'd like so I'll stash this for now and we can revisit if the request occurs again.

@snicoll snicoll closed this Aug 24, 2026
@snicoll snicoll removed their assignment Aug 24, 2026
@snicoll snicoll removed this from the 4.2.0-M2 milestone Aug 24, 2026
@snicoll snicoll added the status: declined A suggestion or change that we don't feel we should currently apply label Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants