1

I deployed a web application in node.js by following the guide: Deploying Node.js With Upstart and Monit .

The app produces some log via console.log(). In the upstart script, it's redirected to a log file (exec sudo -u www-data node app.js >> /var/log/app.log).

How do I rotate this log? Do I need some particular treatment in the Javascript code? Can I send kill -USR1 to nodejs like nginx?

  • Have you already tried actually doing it? what happens? – dawud Apr 17 '14 at 16:06
0

If you are using upstart to manage your daemon, issue a reload in the logrotate config for your application. This should redirect your logging to the new file without disrupting the app.

  • Thanks, but reload myapp will actually shut down the app without restarting. My .conf (init) script do not have a reload section. – He Shiming Apr 18 '14 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.