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

chore(deps): migrated from daysToKeep to numBackups due to streamroller@^3.0.0 #1149

Merged
merged 1 commit into from Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dateFile.md
Expand Up @@ -15,7 +15,7 @@ Any other configuration parameters will be passed to the underlying [streamrolle
* `flags` - `string` (default 'a')
* `compress` - `boolean` (default false) - compress the backup files during rolling (backup files will have `.gz` extension)
* `alwaysIncludePattern` - `boolean` (default false) - include the pattern in the name of the current log file as well as the backups.
* `daysToKeep` - `integer` (default 0) - if this value is greater than zero, then files older than that many days will be deleted during log rolling.
* `numBackups` - `integer` (default 0) - if this value is greater than zero, then files older than that many days will be deleted during log rolling.
* `keepFileExt` - `boolean` (default false) - preserve the file extension when rotating log files (`file.log` becomes `file.2017-05-30.log` instead of `file.log.2017-05-30`).

The `pattern` is used to determine when the current log file should be renamed and a new log file created. For example, with a filename of 'cheese.log', and the default pattern of `.yyyy-MM-dd` - on startup this will result in a file called `cheese.log` being created and written to until the next write after midnight. When this happens, `cheese.log` will be renamed to `cheese.log.2017-04-30` and a new `cheese.log` file created. The appender uses the [date-format](https://github.com/nomiddlename/date-format) library to parse the `pattern`, and any of the valid formats can be used. Also note that there is no timer controlling the log rolling - changes in the pattern are determined on every log write. If no writes occur, then no log rolling will happen. If your application logs infrequently this could result in no log file being written for a particular time period.
Expand Down
2 changes: 1 addition & 1 deletion examples/date-file-rolling.js
Expand Up @@ -5,7 +5,7 @@ const log4js = require('../lib/log4js');
log4js.configure({
appenders: {
file: {
type: 'dateFile', filename: 'thing.log', daysToKeep: 3, pattern: '.mm'
type: 'dateFile', filename: 'thing.log', numBackups: 3, pattern: '.mm'
}
},
categories: {
Expand Down
2 changes: 1 addition & 1 deletion types/log4js.d.ts
Expand Up @@ -187,7 +187,7 @@ export interface DateFileAppender {
// keep the file extension when rotating logs
keepFileExt?: boolean;
// if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0)
daysToKeep?: number;
numBackups?: number;
}

export interface LogLevelFilterAppender {
Expand Down