Tuesday 16 May 2017

Write PM2 logs to custom path

I use PM2 to execute my Node.js app. In order to do that, I have defined the following ecosystem config file:

apps:
  - script   : app.js
    name: "myApp"
    exec_mode: cluster
    cwd: "/etc/myService/myApp"

Everything is working. Now I want to specify the custom path where PM2 will write the logs, therefore into ecosystem config file I added:

log : "/etc/myService/myApp/logs/myApp.log"

It works, but I paid attention that after execution pm2 start ecosystem, PM2 will write the logs to both paths at the same time:

  • /etc/myService/myApp/logs/myApp.log and
  • /home/%$user%/.pm2/logs/

My question:
How can I specify the only place for logs by PM2 and avoid the duplicated logs generation.



via Mike B.

No comments:

Post a Comment