Skip to content

Inverted rollover strategy in log4j-1.2-api #1650

Closed
@ppkarwasz

Description

@ppkarwasz

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.

Metadata

Metadata

Assignees

Labels

bugIncorrect, unexpected, or unintended behavior of existing codegood first issueIssues that are good for contributors looking to get started

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions