GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — count only the current date's backups when RollingFileAppender starts by Snotface · Pull Request #334 · apache/logging-log4net

Conversation

@Snotface

@Snotface Snotface commented Oct 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

RollingFileAppender miscounted backups at start-up: a .yyyyMMdd date was read as a backup index, other dates' backups raised the count, and a date pattern supplying the extension hid the current date's backups. It now counts only the current date's backups.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Snotface and others added 3 commits October 4, 2026 20:31
Snotface @claude
count only the current date's backups when RollingFileAppender starts
27fe9e5
On start-up the appender counts the size backups already on disk and
continues from the highest. It read the number after the last "." of any
matching file, which went wrong in three ways:

- a date pattern without separators (.yyyyMMdd) was read as a backup
  number: counting up the next backup was named .20261004, counting down
  every size roll walked twenty million names
- with staticLogFileName false, a date pattern that supplies the extension
  (.yyyy-MM-dd'.log') and preserveLogFileNameExtension, the current date's
  backups were skipped as "from a different date period", so the count
  restarted at 0 and the next roll deleted the existing backups
- with a static file name, backups already rolled to an earlier date
  raised the current date's count

GetBackupIndex now builds the name the current date's backups must have,
as the appender names them, and counts only files of that name plus .N.
With a static file name, a suffix that parses as a date in DatePattern is
a dated file, not a backup.

A date pattern that formats as a short number (.dd, .MM, .HH, .yyyy)
names the dated file log.txt.10 exactly like backup 10, so one overwrites
the other. For such configurations no numbered backups are made: size
rolling is switched off, the existing file is appended to at start-up when
appendToFile is false, and the reason is written as a FATAL line at the
top of each file and as an internal warning. The new IgnoreDateWarnings
property keeps the configured behaviour for those who accept the risk.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Snotface @claude
add changelog entry for the RollingFileAppender backup count fix
dd9416a
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Snotface @claude
name the changelog entry after the pull request apache#334
9ebb6d9
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
FreeAndNil added a commit that referenced this pull request Oct 4, 2026
@FreeAndNil
count only the current date's backups when RollingFileAppender starts #…
88eedb2
…334

InitializeRollBackups took dated files and other dates' backups for
backups of the current roll point:

* A date without separators (.yyyyMMdd) parsed as a backup index, with a
  static or a non-static name, so the count jumped to 20261004.
* With a static name, log.txt.20261003.1 counted as backup 1.
* A date pattern supplying the extension (.yyyy-MM-dd'.log' with
  PreserveLogFileNameExtension) hid the current date's backups.

Dates of up to four characters (.dd) still count as indexes, they cannot
be told apart. Tests by @Snotface.
@FreeAndNil
narrow the fix to counting only the current date's backups apache#334
ba511c5
InitializeRollBackups took dated files and other dates' backups for
backups of the current roll point:

* A date without separators (.yyyyMMdd) parsed as a backup index, with a
  static or a non-static name, so the count jumped to 20261004.
* With a static name, log.txt.20261003.1 counted as backup 1.
* A date pattern supplying the extension (.yyyy-MM-dd'.log' with
  PreserveLogFileNameExtension) hid the current date's backups.

Dates of up to four characters (.dd) still count as indexes, they cannot
be told apart. Tests by @Snotface.
@FreeAndNil

FreeAndNil commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thanks @Snotface, the backup counting bugs you found are real and your InitializeRollBackups tests pin them down well.

The PR is more than we want in RollingFileAppender for a patch release though:

  • a new public property
  • size rolling switched off
  • a FATAL line in the user's log
  • false positives: .yyyy with maxSizeRollBackups 10 can never meet backup 2024

Here is a smaller fix for the same bugs on top of your branch, with your tests and a changelog entry: ba511c5

Its diff shows what changed against your version. Could you merge or cherry-pick it into your branch and push? It applies without conflicts, and we squash when merging the PR.

git switch feature/apache-date-aware-backup-index
git pull https://github.com/apache/logging-log4net.git Feature/334-rollingfileappender-backup-index
git push

The short date collision (.dd) is existing behaviour and deserves its own issue.

One more request: please keep PR descriptions and changelog entries short. A few lines on what is broken and how it is fixed are much easier to review than a long write-up.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FreeAndNil

FreeAndNil commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@Snotface are you still interested in merging this PR?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@FreeAndNil

FreeAndNil commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@Snotface I will close this PR on 2026-10-19 when we get no feedback from you.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Snotface

Snotface commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, i was away on a conference. Will go through your points and see what i can do. I will provide feedback.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Snotface

Snotface commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, merged and pushed. Builds clean, tests pass.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@Snotface Snotface mentioned this pull request Oct 9, 2026
RollingFileAppender: short date pattern collides with size backup names #335
Closed
@FreeAndNil FreeAndNil added this to the 3.5.1 milestone Oct 10, 2026
FreeAndNil
FreeAndNil approved these changes Oct 10, 2026
View reviewed changes

@FreeAndNil FreeAndNil left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for your contribution.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@FreeAndNil
FreeAndNil merged commit d0efa65 into apache:master Oct 10, 2026
3 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@Snotface
Snotface deleted the feature/apache-date-aware-backup-index branch October 10, 2026 12:02
@FreeAndNil FreeAndNil mentioned this pull request Oct 11, 2026
use a dated file name when the date pattern names files like backups #336
Merged
FreeAndNil added a commit that referenced this pull request Oct 26, 2026
@FreeAndNil
count only the base name's backups without date rolling #338
2fbda3d
- size and once rolling no longer count log.txt.errors.3 as backup 3
- the static name guard from #334 now covers names without dates
FreeAndNil added a commit that referenced this pull request Nov 5, 2026
@FreeAndNil
Fix size-only backup scan for prefix siblings (#339)
849417d
* Fix size-only backup scan for #338

* count only the base name's backups without date rolling #338

- size and once rolling no longer count log.txt.errors.3 as backup 3
- the static name guard from #334 now covers names without dates

---------

Co-authored-by: Jan Friedrich <[email protected]>
This was referenced Nov 12, 2026
Bump log4net from 2.0.15 to 3.6.0 sg-scale/NETworkManager--2022.12.20.0#5
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#80
Closed
Bump the nuget-dependencies group with 14 updates SvenGroot/JumboCore#81
Closed
Bump log4net across 9 directories METACMETAHA/sap-wialon-fleet-audit#75
Open
Bump log4net from 3.5.0 to 3.6.0 ParadoxGameConverters/PGCG.commonItems#964
Merged
Bump log4net from 3.5.0 to 3.6.0 afernandes/ConnectionFactory.NET#12
Open
Bump the minor-and-patch group with 1 update digst/OIOSAML.Net#112
Open
Bump log4net from 3.3.1 to 3.6.0 bbtsoftware/AzureDevOpsPolicyConfigurator#255
Open
Bump log4net from 2.0.8 to 3.6.0 devsecops-lab-luis/demo-ghas-multilenguaje#27
Open
Bump csharpier and 19 others guibranco/CrispyWaffle#1077
Closed
Bump the nuget-minor-and-patch group with 1 update filmliga66/drive-mapper#17
Merged
Bump log4net from 3.5.0 to 3.6.0 OPCFoundation/UA-EdgeTranslator#165
Merged
This was referenced Nov 16, 2026
deps: Bump log4net from 3.3.2 to 3.6.0 OliverRetro/WavePlus#62
Open
Bump the runtime-libraries group with 7 updates CreativeCodersTeam/Core#210
Closed
chore: Bump log4net from 3.5.0 to 3.6.0 mdallago/MDLSoft.NHibernate.AspNet#13
Merged
Bump log4net from 3.3.1 to 3.6.0 bNobo/needabreak#176
Open
Bump log4net from 3.5.0 to 3.6.0 filadelfija-cyber/Reposter#6
Open
Bump log4net from 3.5.0 to 3.6.0 agentthink/ua-protocol-bridge#23
Open
Bump log4net from 3.3.2 to 3.6.0 jasonlandreth/GarminR10-BLE-Connector#7
Open
Bump the minor-and-patch group with 4 updates Ed-Fi-Alliance-OSS/ODS-Admin-API#559
Merged
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5265
Open
Bump the dependencies group with 22 updates guibranco/CrispyWaffle#1126
Closed
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5279
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5280
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5281
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5282
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5283
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5284
Open
DEV: Bump log4net from 3.5.0 to 3.6.0 origam/origam#5285
Open
This was referenced Nov 23, 2026
Bump the runtime-libraries group with 7 updates CreativeCodersTeam/Core#213
Open
Bump Crc32.NET and 12 others SvenGroot/JumboCore#84
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Serializers#224
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Menu.OracleDatamodelMenu#119
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Metadata#110
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Menu.MsSqlDatamodelMenu#117
Open
Bump the minor-version-updates group with 2 updates PxTools/PXWeb.SavedQuery.Oracle#122
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Core#145
Open
Bump the minor-version-updates group with 13 updates statisticssweden/DataportalXML#78
Open
Bump log4net from 3.5.0 to 3.6.0 mishka1c/mRemoteNX#12
Closed
Bump the dependencies group with 17 updates guibranco/CrispyWaffle#1136
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Query#119
Open
Bump the minor-version-updates group with 2 updates PxTools/PCAxis.Menu#104
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@FreeAndNil FreeAndNil FreeAndNil approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

3.6.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Snotface @FreeAndNil
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.