Property "tailable: true" is not working as declared for winston File Transport
See original GitHub issueEnvironment:
winston@3
node -v
:v8.6.0
andv10.7.0
- Operating System : Windows
- Language ES6
Problem: I am using File winston transport in this way:
const fileTransport = new transports.File({
filename: 'log.out',
level: 'debug',
maxsize: 100*1024, // 10 MB
maxFiles: 3,
json: false,
tailable: true
});
const logger = winston.createLogger({
level: 'debug',
format: combine(formatFile),
transports: fileTransport,
handleExceptions: true
});
File ‘log.out’ is created in necessary directory, but after the maxsize reached, logging is stopped, it means no files created. But in ‘tailable’ property description “If true, log files will be rolled based on maxsize and maxfiles, but in ascending order. The filename will always have the most recent log lines. The larger the appended number, the older the log file”
I think, problem is that code of creating new and renaming old log files is unreachable:
from
https://github.com/winstonjs/winston/blob/a32aa3c74859054f0351ac26b3079a5bc21f82b5/lib/winston/transports/file.js#L600
due to internal error in asyncSeries() function: https://github.com/winstonjs/winston/blob/a32aa3c74859054f0351ac26b3079a5bc21f82b5/lib/winston/transports/file.js#L615 https://github.com/winstonjs/winston/blob/a32aa3c74859054f0351ac26b3079a5bc21f82b5/lib/winston/transports/file.js#L12
and this code is also unreachable: https://github.com/winstonjs/winston/blob/a32aa3c74859054f0351ac26b3079a5bc21f82b5/lib/winston/transports/file.js#L617 (only in case “maxFiles: 1”, then tasks array is empty)
Similiar Github issues: https://github.com/winstonjs/winston/issues/589 https://github.com/winstonjs/winston-daily-rotate-file/issues/23 (“still doesn’t work with winston@2.4.1”) https://github.com/winstonjs/winston/issues/1264
Issue Analytics
- State:
- Created 5 years ago
- Reactions:5
- Comments:6 (4 by maintainers)
Top GitHub Comments
Sweet. We will be publishing a 3.x update to npm very soon!
I can confirm that
tailable
is broken in 3.0.0 and fixed in master.