Unitech / Unitech/pm2

Pino logging getting lost with pm2

Open
#4,872 10 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

What's going wrong?

I'm using pino for logging but when using pm2 my logs are not showing up - this issue on the pino github suggests it's down to pm2 doing something non standard with process.stdout.

For now I've switched to forever on production since that doesn't have this issue but would like to move back to pm2.

How could we reproduce this issue?

Add pino to a script and log something - note that it doesn't show up in pm2 logs

Supporting information

Pino docs

--- PM2 report ----------------------------------------------------------------
Date : Thu Oct 08 2020 05:23:36 GMT+0000 (Coordinated Universal Time)

--- Daemon -------------------------------------------------
pm2d version : 4.4.0
node version : 14.13.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 0min

--- CLI ----------------------------------------------------
local pm2 : 4.4.0
node version : 14.13.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/bin/pm2,report
argv0 : node
user : root
uid : 0
gid : 0

--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz
cpus nb : 1
freemem : 75190272
totalmem : 1029009408
home : /root

--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘

--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2 | 2020-10-05T10:52:39: PM2 log: [PM2] This PM2 is not UP TO DATE
PM2 | 2020-10-05T10:52:39: PM2 log: [PM2] Upgrade to version 4.5.0
PM2 | 2020-10-06T09:02:01: PM2 log: pm2 has been killed by signal, dumping process list before exit...
PM2 | 2020-10-06T09:02:01: PM2 log: Exited peacefully
PM2 | 2020-10-08T05:23:36: PM2 log: ===============================================================================
PM2 | 2020-10-08T05:23:36: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2 | 2020-10-08T05:23:36: PM2 log: Time : Thu Oct 08 2020 05:23:36 GMT+0000 (Coordinated Universal Time)
PM2 | 2020-10-08T05:23:36: PM2 log: PM2 version : 4.4.0
PM2 | 2020-10-08T05:23:36: PM2 log: Node.js version : 14.13.0
PM2 | 2020-10-08T05:23:36: PM2 log: Current arch : x64
PM2 | 2020-10-08T05:23:36: PM2 log: PM2 home : /root/.pm2
PM2 | 2020-10-08T05:23:36: PM2 log: PM2 PID file : /root/.pm2/pm2.pid
PM2 | 2020-10-08T05:23:36: PM2 log: RPC socket file : /root/.pm2/rpc.sock
PM2 | 2020-10-08T05:23:36: PM2 log: BUS socket file : /root/.pm2/pub.sock
PM2 | 2020-10-08T05:23:36: PM2 log: Application log path : /root/.pm2/logs
PM2 | 2020-10-08T05:23:36: PM2 log: Worker Interval : 30000
PM2 | 2020-10-08T05:23:36: PM2 log: Process dump file : /root/.pm2/dump.pm2
PM2 | 2020-10-08T05:23:36: PM2 log: Concurrent actions : 2
PM2 | 2020-10-08T05:23:36: PM2 log: SIGTERM timeout : 1600
PM2 | 2020-10-08T05:23:36: PM2 log: ===============================================================================

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with a minimal JavaScript script that uses pino, run it under pm2, and compare its output with pm2 logs. No repository file or test is identified; done means pino log output reliably appears in the relevant pm2 logs, including with the reported Node.js and pm2 versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cli, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.