Frank Malenfant Frank Malenfant -4 years ago 164
Node.js Question

How to access a Node.js application log lauched through pm2

I've been developing a Node.js application using Socket.IO, Express, MySql and https and everything worked fine until I "deamonized" it with pm2. Now, my socket seems somehow unresponsive and I'd like to debug it. The problem is that I can't seem to find where the console.log() function from this code outputs its text anymore.

I case you'd like to know, all my pm2 processes are online and I can refresh my pages from the client side. But there should be a fonction on the server that triggers an event on the client side when something happens in the database and it does not.

Could tell me where the output from consone.log() is goes?

Answer Source

From PM2 docs:

PM2 allows you to easily manage your application’s logs. You can display the logs coming from all your applications in real-time, flush them, and reload them. There are also different ways to configure how PM2 will handle your logs (separated in different files, merged, with timestamp…) without modifying anything in your code.

And other SO question:

Make pm2 log to console

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download