I use winston.log to append log files. Every time I restart my application, the exist log is deleted, and new one is created.
Is there any way to append the logs files? so it will deleted just in rotate rule?
Here is the relevant code:
var winston = require('winston');
var loggerNoCache = new(winston.Logger)({
transports: [
new(winston.transports.File)({
filename: '/var/log/logNo.log',
options: {
highWaterMark: 32
}
})
]
});
You could pass an appendable WriteableStream via the stream
property, perhaps something like:
new(winston.transports.File)({
stream: fs.createWriteStream('/var/log/logNo.log', {flags: 'a'}),
options: {
...
Most recent solution for streams in winston :
new winston.transports.Stream({
stream: fs.createWriteStream('/var/log/logNo.log', {flags: 'a'}),
level: fileLoggingLevel
}));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With