Reputation: 183
I was wondering, is there any way I can check out the logs of the my nodejs server when I've forever'd it using forever start server.js
to look at what's being logged, check any live errors and such.
I looked at their documentation but couldn't find anything related to this. I want to be able to look at the console.
Upvotes: 2
Views: 2625
Reputation: 3317
As forever start an application on background it gets hard to access old logs. If you can use a library for maintaining logs, I will suggest simple-node-logger . Using this library you can save all your logs on a file and can access that file any time using:
tail -f logsFile.txt
Using this command this will keep printing new changes over logsFile.txt as logger keep updating logs. This will help you to maintain all the logs for you.
Upvotes: 1
Reputation: 413
First find out where your logs are stored using:
sudo forever list
for each process you can see something like this as logfile:
/root/.forever/_Jht.log
use 'tail -f' to monitor its changes:
sudo tail -f /root/.forever/_Jht.log
You can also set your desired path for log files, see this:
https://stackoverflow.com/a/21021251/1119611
Upvotes: 0