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

dateFile Appender daysToKeep not rolling by days #1035

Closed
wangduanduan opened this issue Aug 1, 2020 · 3 comments · Fixed by log4js-node/streamroller#78 or #1135
Closed

dateFile Appender daysToKeep not rolling by days #1035

wangduanduan opened this issue Aug 1, 2020 · 3 comments · Fixed by log4js-node/streamroller#78 or #1135
Milestone

Comments

@wangduanduan
Copy link

@wangduanduan wangduanduan commented Aug 1, 2020

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

when the pattern is not .yyyy-MM-dd, the daysToKeep not work as doc says.

for example. when pattern is .yyyy-MM-dd-hh-mm, the daysToKeep is not control the old log Rolling by days, just keep the logs backups not more than daysToKeep.

log4js.configure({
    appenders: {
      well: {
        type: 'dateFile',
        filename: logFileName,
        pattern: '.yyyy-MM-dd-hh-mm',
        compress: true,
        daysToKeep: 3
      },
      console: { type: 'console' }
    },
    categories: {
      well: { appenders: [ 'well' ], level: 'debug'},
      default: {appenders: ['console'], level: 'debug'}
    }
})

log files

-rw-r--r--  1 dd  staff   855B Aug  1 14:59 well.log
-rw-r--r--  1 dd  staff   197B Aug  1 14:39 well.log.2020-08-01-14-38.gz
-rw-r--r--  1 dd  staff   323B Aug  1 14:45 well.log.2020-08-01-14-39.gz
-rw-r--r--  1 dd  staff   140B Aug  1 14:59 well.log.2020-08-01-14-45.gz
@beita1
Copy link

@beita1 beita1 commented Oct 30, 2021

I also found this issue, do you have some new progress?

@lamweili
Copy link
Contributor

@lamweili lamweili commented Jan 4, 2022

Related to #1080.

@beita1
Copy link

@beita1 beita1 commented Jan 4, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants