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

numBackups documentation not correct #1239

Closed
jkopczyn opened this issue May 9, 2022 · 4 comments · Fixed by #1240
Closed

numBackups documentation not correct #1239

jkopczyn opened this issue May 9, 2022 · 4 comments · Fixed by #1240
Labels
documentation Improvements or additions to documentation
Milestone

Comments

@jkopczyn
Copy link

jkopczyn commented May 9, 2022

The switch from daysToKeep to numBackups in #1149 left the documentation out of date, see here and here. It is not clear what the behavior is, or is supposed to be.

@lamweili
Copy link
Contributor

lamweili commented May 11, 2022

The documentation is correct. Please reference the documentation for now, amidst the confusion.

* `numBackups` - `integer` (default 1) - the number of old files that matches the pattern to keep (excluding the hot file).

The comment in the below typescript definition is outdated. The update to the documentation in #1181 missed this out.

// if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0)

@lamweili lamweili linked a pull request May 11, 2022 that will close this issue
@lamweili lamweili added this to the 6.4.7 milestone May 11, 2022
@lamweili lamweili added the documentation Improvements or additions to documentation label May 11, 2022
@lamweili
Copy link
Contributor

Might have a few other updates to documentation that is not reflected in the comments in the typescript definition.
I shall indicate PR #1240 as draft till I sieve them out.

@lamweili
Copy link
Contributor

lamweili commented May 11, 2022

@jkopczyn For clarity, daysToKeep was renamed to numBackups.
numBackups is the number of old backups (excluding the hot file).

The variable name daysToKeep didn't make sense due to some of the examples below (which are not in days):

  • pattern='yyyy-MM-dd' and numBackups=5:
    1 hot/current + 5 backup(s) of previous days = 6 file(s)

  • pattern='yyyy-MM' and numBackups=0:
    1 hot/current + 0 backup(s) of previous months = 1 file(s)

  • pattern='yyyy-MM-dd-hh:mm:ss' and numBackups=30:
    1 hot/current + 30 backup(s) of previous seconds = 31 file(s)

@lamweili
Copy link
Contributor

Fixed in log4js@6.4.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants