title: Access NodeJS logs in server using pm2
body: <p>I recently deployed a node JS app to a debian server using Nginx and PM2.</p>
  
  <p>Everything seems to be working fine, I can access the website from the link and port i specified in my nginx configuration.</p>
  
  <p>In my app I save values to a database (using mongojs). While running this webpage everything seems to be fine but nothing is being saved to the database.
  So i assumed i have an error in my nodeJS app.</p>
  
  <p>I tried to access the logs of my nodejs app, I cleared the pm2 logs, went to my site URL again, and then I executed the command <code>pm2 logs</code> but couldn't see any logs at all.</p>
  
  <p>I need to access the logs of my app (AKA the logs that are usually displayed when i manually write <code>node app.js</code> locally in the terminal).</p>
  
  <p>Sorry i am new at this </p>
  
  <p>Am i missing something?</p>
  
  <p>My PM2 logs :</p>
  
  <pre><code>PM2        | [2018-05-14 13:21:56] PM2 error: Cancelling versioning data parsing
  PM2        | [2018-05-14 13:21:56] PM2 log: App [app] with id [0] and pid [12345], exited with code [0] via signal [SIGINT]
  PM2        | [2018-05-14 13:21:56] PM2 log: pid=12345 msg=process killed
  PM2        | [2018-05-14 15:34:32] PM2 log: Starting execution sequence in -fork mode- for app name:app id:0
  PM2        | [2018-05-14 15:34:32] PM2 log: App name:app id:0 online
  PM2        | [2018-05-15 13:31:27] PM2 log: Stopping app:app id:0
  PM2        | [2018-05-15 13:31:27] PM2 log: App [app] with id [0] and pid [12345], exited with code [0] via signal [SIGINT]
  PM2        | [2018-05-15 13:31:27] PM2 log: pid=12345 msg=process killed
  PM2        | [2018-05-15 13:32:59] PM2 log: Starting execution sequence in -fork mode- for app name:app id:0
  PM2        | [2018-05-15 13:32:59] PM2 log: App name:app id:0 online
  PM2        | [2018-05-15 13:39:15] PM2 log: Stopping app:app id:0
  PM2        | [2018-05-15 13:39:15] PM2 log: App [app] with id [0] and pid [54321], exited with code [0] via signal [SIGINT]
  PM2        | [2018-05-15 13:39:15] PM2 log: pid=54321 msg=process killed
  PM2        | [2018-05-15 13:39:41] PM2 log: Starting execution sequence in -fork mode- for app name:app id:0
  PM2        | [2018-05-15 13:39:41] PM2 log: App name:app id:0 online
  </code></pre>
  
  <p>My PM2 list:</p>
  
  <pre><code>App name │ id │ mode │ pid   │ status │ restart │ uptime │ cpu │ mem       │ user   │ watching │
  ├──────────┼────┼──────┼───────┼────────┼─────────┼────────┼─────┼───────────┼────────┼──────────┤
  │ app      │ 0  │ fork │ 54321 │ online │ 12      │ 7m     │ 0%  │ 40.7 MB   │ user │ disabled │
  </code></pre>