I just discovered that my nodejs app keeps crashing, so I've used forever app.js
to start my app and have it automatically restarted when it crashes.
Problem: Now my app outputs alot of useful information as it runs via console.log
and util.log
. I used to use screen
to run the node app, but now that I'm using forever to run the nodejs app, I can no longer see all the outputs.
Is there any way to see all the output from the nodejs app in realtime?
Forever, by default, will put logs into a random file in ~/. forever/ folder. You should run forever list to see the running processes and their corresponding log file.
Steps to Open the Console Log in Google Chrome By default, the Inspect will open the "Elements" tab in the Developer Tools. Click on the "Console" tab which is to the right of "Elements". Now you can see the Console and any output that has been written to the Console log.
log and console.The built-in console module in Node. js lets you write log messages to standard output (stdout) and standard error (stderr)using the log and error functions, respectively.
So, yes for every console. log call, some variables are created. The memory increase depends what and how many times your code logs.
Directly with forever command :
forever logs app.js -f
It shows in realtime output of your application and forever logs (shows detected changes & restart messages).
You can watch a logfile live by using this shell-command.
tail -f /path/to/logfile
Not sure if this is what you needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With