Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to see PM2 restart history (node-pm2)

Tags:

pm2

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.

like image 395
Thịnh Phạm Avatar asked Dec 02 '16 02:12

Thịnh Phạm


People also ask

Where are my PM2 logs?

Access the logs By default, all logs are saved into $HOME/. pm2/logs .

Does PM2 auto restart after reboot?

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.

How does PM2 restart work?

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.

How do I check my PM2 service?

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.


2 Answers

PM2 logs are streamed into the file ˜/.pm2/pm2.log

like image 144
Unitech Avatar answered Oct 08 '22 08:10

Unitech


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.

like image 31
MattJHoughton Avatar answered Oct 08 '22 08:10

MattJHoughton