Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running my Node app with Forever does not log any output

I am running my node project using Forever on a Amazon CentOS EC2 instance using the following command:

forever start -o /home/ec2-user/logs/www.log -e /home/ec2-user/logs/www.err app.js

My application runs properly but there are no www.log or www.err files created in the logs directory. I tried manually creating these files and setting chmod 777, and still, there is no data logged to these files. I am certain that there should be data logging; I am running the same project in a similar environment and everything is logging OK. Any help is appreciated!

like image 342
Original Rockers Avatar asked Dec 06 '11 18:12

Original Rockers


People also ask

How do I run node server continuously?

js application locally after closing the terminal or Application, to run the nodeJS application permanently. We use NPM modules such as forever or PM2 to ensure that a given script runs continuously. NPM is a Default Package manager for Node.

Why do you use forever with node js?

Forever is an npm module that ensures a Node. js script continuously runs in the background on the server. It's a helpful CLI tool for the production environment because it helps manage the Node applications and their processes.


1 Answers

I think there was a breaking change in one of the more recent node releases. Someone recently filed a related issue on GitHub: https://github.com/nodejitsu/forever/issues/193

Unfortunately Forever seems to output child process error messages to stdout, so redirecting stderr to a file doesn't work. A temporary workaround would be to use an older version of node. Hopefully a fix will be out soon.

like image 55
Jon Nadal Avatar answered Oct 13 '22 11:10

Jon Nadal