I'm trying to setup a simple daily rotation log write with:
// Create file transport
transports.push(new winston.transports.DailyRotateFile({
name: 'file',
datePattern: '.yyyy-MM-ddTHH',
filename: path.join(logPath, 'http')
}));
// Create new logger
var logger = new winston.Logger({
transports: transports
});
It's creating the log file just fine, however logger.info(some_data) doesn't write anything to the log.
Any thoughts, or even another solution?
log.info(some_data)is used or where the variablelogis instantiated. I do seelogger, but notlog. - AlexMAlogger.info- Fluidbytesome_datais not empty, and the logger is ready, either an error should have been generated or the file that was written to is somewhere you did not expect. Perhaps insert alogger.on('error', function (err) { /* Do Something */ });and see if an error is being generated? - AlexMAconsole.log(some_data)to see ifsome_dataactually contains data. Or use a string for logger testing. Another solution could be to add the log level for the transport. If it is set toerrorfor example, you wouldn't seeinfolog requests. - atripes