Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inverted rollover strategy in log4j-1.2-api #1650

Closed
ppkarwasz opened this issue Aug 1, 2023 · 4 comments
Closed

Inverted rollover strategy in log4j-1.2-api #1650

ppkarwasz opened this issue Aug 1, 2023 · 4 comments
Assignees
Labels
bug Incorrect, unexpected, or unintended behavior of existing code good first issue Issues that are good for contributors looking to get started
Milestone

Comments

@ppkarwasz
Copy link
Contributor

Description

The default rollover strategy in Log4j 1.x archived the current log file File always to File.1:

If MaxBackupIndex is positive, then files {File.1, ..., File.MaxBackupIndex -1} are renamed to {File.2, ..., File.MaxBackupIndex}. Moreover, File is renamed File.1 and closed. A new File is created to receive further log output. [source Javadoc]

This corresponds to the fileIndex="min" rollover strategy of the version 2.x RollingFileAppender (cf. documentation).

However the RollingFileAppenderBuilder from log4j-1.2-api creates a fileIndex="max" rollover strategy (the default strategy in Log4j 2.x).

This problem was reported in the SO question Log4j 1.2 Bridge update to 2.17.2 RollingFileAppender MaxBackupIndex Problem.

Affected version

Versions 2.20.0 and 3.0.0-alpha1 are both affected.

@ppkarwasz ppkarwasz added bug Incorrect, unexpected, or unintended behavior of existing code good first issue Issues that are good for contributors looking to get started labels Aug 1, 2023
@ppkarwasz ppkarwasz added this to the 2.20.1 milestone Aug 1, 2023
@krzyk
Copy link
Contributor

krzyk commented Aug 1, 2023

Hi, could I work on fix for this issue?

@ppkarwasz
Copy link
Contributor Author

ppkarwasz commented Aug 1, 2023

@krzyk,

Sure, go ahead. Just remember to add a unit test, so we prevent future regressions.

@krzyk
Copy link
Contributor

krzyk commented Aug 22, 2023

@ppkarwasz So, I assume this can be closed?

@ppkarwasz
Copy link
Contributor Author

Yes, of course.

Usually Github closes the issue linked to a PR automatically, but it requires one of the accepted keywords in the PR's description (cf. GitHub documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect, unexpected, or unintended behavior of existing code good first issue Issues that are good for contributors looking to get started
Projects
None yet
Development

No branches or pull requests

2 participants