Skip to content

Commit 53248cd

Browse files
authored
Merge pull request #1149 from log4js-node/migrate-daysToKeep-to-numBackups
chore(deps): migrated from daysToKeep to numBackups due to streamroller@^3.0.0
2 parents 436d9b4 + d4617a7 commit 53248cd

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

docs/dateFile.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Any other configuration parameters will be passed to the underlying [streamrolle
1515
* `flags` - `string` (default 'a')
1616
* `compress` - `boolean` (default false) - compress the backup files during rolling (backup files will have `.gz` extension)
1717
* `alwaysIncludePattern` - `boolean` (default false) - include the pattern in the name of the current log file as well as the backups.
18-
* `daysToKeep` - `integer` (default 0) - if this value is greater than zero, then files older than that many days will be deleted during log rolling.
18+
* `numBackups` - `integer` (default 0) - if this value is greater than zero, then files older than that many days will be deleted during log rolling.
1919
* `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`).
2020

2121
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.

examples/date-file-rolling.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const log4js = require('../lib/log4js');
55
log4js.configure({
66
appenders: {
77
file: {
8-
type: 'dateFile', filename: 'thing.log', daysToKeep: 3, pattern: '.mm'
8+
type: 'dateFile', filename: 'thing.log', numBackups: 3, pattern: '.mm'
99
}
1010
},
1111
categories: {

types/log4js.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export interface DateFileAppender {
189189
// keep the file extension when rotating logs
190190
keepFileExt?: boolean;
191191
// if this value is greater than zero, then files older than that many days will be deleted during log rolling.(default 0)
192-
daysToKeep?: number;
192+
numBackups?: number;
193193
}
194194

195195
export interface LogLevelFilterAppender {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy