javascript - Crontab blocking winston to write to my log files -
i'm using winston log output node js app log file, when run app crontab job, not write log file. setup of winston transport:
var winston = require('winston'), gettimestamp = function() { return new date().tostring(); } if(process.env.node_env === 'production' || process.env.node_env === 'test') { winston.add(winston.transports.file, { filename: environment.logfilename, maxsize: 1024*1024*10, //10mb timestamp: gettimestamp(), colorize: true }); winston.remove(winston.transports.console); } winston.exitonerror = false;
winston seems work fine if direct output cron.log file, this:
0 12 * * 1 /apps/accounting/server/invoice_worker/test.sh >> /var/log/cron.log
or if use console.log output.
i tried doing , did not fix issue:
0 12 * * 1 /apps/accounting/server/invoice_worker/test.sh >> /dev/null 2>&1
winston not writing test or production logs regardless of environment run app in. advice please. thanks!
the issue has been solved. did mistake of not providing absolute paths log files inside node server , crontab require absolute paths
Comments
Post a Comment