Repository navigation
Run RollingAppenderCountTest on 2.x again - #4413
Merged
ramanathan1504 merged 7 commits intoOct 22, 2026
Merged
Conversation
Signed-off-by: Sharang Gupta <sharang@sharanggupta.dev>
The test was ignored for LOG4J2-3522 because it was flaky. Port the approach of the fix on main (4387a2f): wait for the rollovers with a RolloverListener and a CountDownLatch instead of sleeping between log events, and check the number of files in the test method.
This reverts commit ae1d323.
Keep the check of the 17 files in @afterclass, which runs after the rule has stopped the logger context, so it does not depend on the rollovers having completed on the logging thread.
Contributor
|
Fixed |
ramanathan1504
approved these changes
Oct 20, 2026
ramanathan1504
enabled auto-merge (squash)
October 21, 2026 12:51
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.
RollingAppenderCountTesthas been@Ignored on2.xsince it was found to be flaky in LOG4J2-3522. The fix for that issue, 4387a2f, only went tomain. It replaced theThread.sleep(250)between the log events with aRolloverListenerand aCountDownLatch, and wrote more data per iteration.This ports that approach to the
2.xtest, keeping its JUnit 4 rule. The test registers itself as aRolloverListeneron theRollingFilemanager, logs 60 iterations without sleeping, and waits for at least 16 rollovers. The check for the 17 files stays in@AfterClass, which runs after the rule has stopped the logger context. The test no longer sleeps for 15 seconds../mvnw -pl :log4j-core-test -am verify -Dtest=RollingAppenderCountTestpasses locally on JDK 17, in every Surefire execution oflog4j-core-test.