Unitech / pm2

Node.js Production Process Manager with a built-in Load Balancer.
https://pm2.keymetrics.io/docs/usage/quick-start/
Other
41.4k stars 2.61k forks source link

pm2 attach does not print backlog #3082

Open ninja- opened 7 years ago

ninja- commented 7 years ago

What's going wrong?

pm2 attach seems not to work correctly

How could we reproduce this issue?

  1. Start any nodejs program using $ pm2 start myapp.js
  2. Verify it's working on pm2 ls
  3. pm2 attach is stuck forever with empty output

Meanwhile pm2 start myapp.js --attach works great and I can see the log from the start Is it supposed to print a few lines of backlog using this command? I assumed so...

Supporting information

pm2 --version; node --version 2.6.1 v8.2.1

ninja- commented 7 years ago

Hm it seems like the command to view the logs is pm2 logs <id> which works fine. It would be good to show the backlog on pm2 attach id so we could have a gnu screen like functionality. Can this be considered a feature request?

FireController1847 commented 7 years ago

If you use Ubuntu and run pm2 logs <id> --raw --nostream --lines 250; pm2 attach <id>, it will print the last 250 lines and immediately after attach to the process, creating a seamless attachment. It would be nice to just be able to do pm2 attach <id> --lines 250 though.