Skip to content

Reopen log file when rollover is unsuccessful#3226

Merged
ppkarwasz merged 3 commits intoapache:2.xfrom
king-tyler:issue-2592-rolling-deleted-file
Nov 22, 2024
Merged

Reopen log file when rollover is unsuccessful#3226
ppkarwasz merged 3 commits intoapache:2.xfrom
king-tyler:issue-2592-rolling-deleted-file

Conversation

@king-tyler
Copy link
Copy Markdown
Contributor

Fixes #2592
Fixes RollingFileManager to reopen the log file when the rollover was unsuccessful

See also #3021 (comment)

Checklist

  • Base your changes on 2.x branch if you are targeting Log4j 2; use main otherwise
  • ./mvnw verify succeeds (if it fails due to code formatting issues reported by Spotless, simply run ./mvnw spotless:apply and retry)
  • Non-trivial changes contain an entry file in the src/changelog/.2.x.x directory
  • Tests for the changes are provided
  • Commits are signed (optional, but highly recommended)

Copy link
Copy Markdown
Contributor

@ppkarwasz ppkarwasz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@king-tyler,

Thank you for your PR. It certainly solves the #2592 issue, but I would take the opportunity to clarify some RollingFileManager code.

IMHO, the code of the rolling file appenders is very unclear and hard to maintain, which is the cause of the multitude of bug reports for this component.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 21, 2024

Job Requested goals Build Tool Version Build Outcome Build Scan®
build-macos-latest clean install 3.9.8 Build Scan PUBLISHED
build-ubuntu-latest clean install 3.9.8 Build Scan PUBLISHED
build-windows-latest clean install 3.9.8 Build Scan PUBLISHED
Generated by gradle/develocity-actions

@ppkarwasz ppkarwasz merged commit 7959176 into apache:2.x Nov 22, 2024
@ppkarwasz
Copy link
Copy Markdown
Contributor

@king-tyler,

Thank You for your contribution! 💯

jvz pushed a commit that referenced this pull request Jul 29, 2025
Fixes `RollingFileManager` to reopen the log file when the rollover was unsuccessful
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

After a log file is deleted by mistake, a new rollover file cannot be created.

2 participants