Pm2: Logs not streaming to console

Created on 29 Jan 2018  ยท  16Comments  ยท  Source: Unitech/pm2

What's going wrong?

When doing pm2 logs new log entries are not getting shown. They used to.
I'm running a local node.js application which logs the loading process on startup. When (re)starting, the logs are not showing new logs.
When exiting logs and doing pm2 logs again, the old logs (that should have been streamed before) show up in the recent logs.

How could we reproduce this issue?

No idea.

Supporting information

Complete uninstall and reinstall does not fix this. I have also tried a different process and the same exact thing happens. I have also rebooted.

EDIT: To put it simply, it's like doing pm2 logs --nostream, but instead of auto-exiting logs, it just sits there (it doesn't say "streaming logs ... etc")

Report dump:
```===============================================================================

--- PM2 REPORT (Mon Jan 29 2018 00:59:55 GMT+0000 (GMT Standard Time)) --------

--- Daemon -------------------------------------------------
pm2d version : 2.9.3
node version : 8.4.0
node path : undefined
argv : D:\Software\NodeJS\node.exe,C:\Users\jacob\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0 : node
user : undefined
uid : N/A
gid : N/A

uptime : 48min

--- CLI ----------------------------------------------------
local pm2 : 2.9.3
node version : 8.4.0
node path : undefined
argv : D:\Software\NodeJS\node.exe,C:\Users\jacob\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0 : node

user : jacob

--- System info --------------------------------------------
arch : x64
platform : win32
type : Windows_NT Edit: NT??? Windows 10.
cpus : AMD FX(tm)-8320 Eight-Core Processor
cpus nb : 8
freemem : 9777438720
totalmem : 17135693824

home : C:\Users\jacob

--- PM2 list -----------------------------------------------
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ App name โ”‚ id โ”‚ mode โ”‚ pid โ”‚ status โ”‚ restart โ”‚ uptime โ”‚ cpu โ”‚ mem โ”‚ user โ”‚ watching โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ nodebot โ”‚ 0 โ”‚ fork โ”‚ 10800 โ”‚ online โ”‚ 1 โ”‚ 2m โ”‚ 0% โ”‚ 44.5 MB โ”‚ jacob โ”‚ disabled โ”‚

โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

--- Daemon logs --------------------------------------------
C:\Users\jacob.pm2\pm2.log last 20 lines:
PM2 | 2018-01-29 00:56:59: Stopping app:nodebot id:0
PM2 | 2018-01-29 00:56:59: App [nodebot] with id [0] and pid [10460], exited with code [1] via signal [SIGINT]
PM2 | 2018-01-29 00:56:59: pid=10460 msg=process killed
PM2 | 2018-01-29 00:56:59: Starting execution sequence in -fork mode- for app name:nodebot id:0
PM2 | 2018-01-29 00:56:59: App name:nodebot id:0 online```

Thanks in advance.

stale

Most helpful comment

I have the same issue :(. But no case to explain :)

All 16 comments

Update: somehow it's randomly fixed itself.

Hi @MrDrummer ,

Ok feel free to reopen it if you can reproduce.

I have the same issue :(. But no case to explain :)

I got this issue again and to fix it I killed all node.js processes and then relaunched it. This of course contradicts my previous statement of rebooting, but I guess it's a method to try as soon as you notice this issue.

OK, I just got this issue again. I beleive it's what happened the last time it happened to me.

To reproduce:
After a Windows 10 restart, start a node.js application with a batch file. (only flag is --name)

For me it has "spawning Daemeon" and doesn't do anything (didn't even start the app). I start it again and then it starts the app but doesn't show the logs. I know this because i do pm2 logs and restart the app. In my case i have a console.log when it's starting up, and the app is actually restarting, but isn't logged.

As I previously explained, to fix this I stop the app (important) then force exit via task manager all node.js processes (just the ones with the green icon). I start up the app again, it does its "spawning Daemeon" thing, close, restart and doing pm2 logs will work as expected.

Again, I'm not sure why a restart didn't fix it originally. ยฏ_(ใƒ„)_/ยฏ

@wallet77 (IDK how to reopen tickets)

on the same boat, using tail -f for now

I had the same issue (identical output aka no log steam), but not with pm2 logs. Instead I was starting an app with pm2-runtime that was not showing logs.

For some reason when I run pm2 delete with no args prior my target cmd, this fixes the issue for me:

# we need the || instead of && because 'pm2 delete' with no args prints help and exits 1
pm2 delete || pm2-runtime ...

This might work for pm2 logs as well.

Having the same issue.

I was having the same problem and the root cause was a zombie pm2 process ("PM2 v3.2.1: God Daemon"). I just killed it and now everything is working fine.

ps -ef | grep PM2

Having the same issue, and it was after update pm2 to 3.2.2

@rogerweb Yes. After kill all the zombie pm2 process, it works fine.
I think PM2 should do such things like automatically killing all other PM2 processes under the same user.

Maybe a "pm2 kill" command? On windows there is a single command to kill all node processes, which is fine for me since it wont affect anything else running.

in Ubuntu, I had used "sudo pm2 kill ". and run process again it works for me...

@flytbasepratap i used that command and still have a zombie. it killed the normal daemon but a zombie version of one of my apps run, and it is responding to requests for the service, but still no logs

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

I had the same issue. i was enough for me to restart the pm2 server on nodejs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  ยท  3Comments

rangercyh picture rangercyh  ยท  4Comments

alexpts picture alexpts  ยท  3Comments

lefam picture lefam  ยท  3Comments

FujiHaruka picture FujiHaruka  ยท  3Comments