Is it possible to see the restart log/history with PM2 app?
I saw my nodeJS app restarted a few times but no clue when.
I've checked pm2 documentation but no luck.
Access the logs By default, all logs are saved into $HOME/. pm2/logs .
When the server restarts, it will automatically restart PM2, which will then restart all the Node. js applications/processes it is managing. In this article, we will show you how to deploy PM2 as a service to reliably manage your Node.
When you generate a startup script, PM2 will automatically restart at boot time. PM2 automatically generates and configures a startup script when you execute the pm2 startup command. To use the startup script, make sure your system has a supported init system.
To check the logs for the different microservices of Lisk Service, use the command pm2 logs PROCESS_NAME , where PROCESS_NAME is the respective PM2 managed process that contains the logs you wish to view.
PM2 logs are streamed into the file ˜/.pm2/pm2.log
You can run the command: pm2 logs
for an output of all logs, relating to running apps and their error logs.
The first log file in the window will be the default PM2 ones, for this kind of information.
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