PM2 logs everything to pm2.log
Open
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?
Anything my node js app logs goes straight to the daemon log (pm2.log) instead of going to the process's log file.
For multiple processes, all of them go to pm2.log
How could we reproduce this issue?
- Run a nodejs app using pm2
- console.log anything in the application
- notice it goes to pm2.log instead of app's log file
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Fri Nov 13 2020 08:28:36 GMT+0000 (Coordinated Universal Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.4.0
node version : 14.8.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : ubuntu
uid : 1000
gid : 1000
uptime : 53min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.4.0
node version : 14.8.0
node path : /usr/bin/pm2
argv : /usr/bin/node,/usr/bin/pm2,report
argv0 : node
user : ubuntu
uid : 1000
gid : 1000
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : linux
type : Linux
cpus : Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
cpus nb : 1
freemem : 1047068672
totalmem : 2081546240
home : /home/ubuntu
===============================================================================
--- PM2 list -----------------------------------------------
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0 │ mbl-api │ cluster │ 0 │ online │ 0.2% │ 45.8mb │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/home/ubuntu/.pm2/pm2.log last 20 lines:
PM2 | Connected to database MONGO
PM2 | Listening to 3000
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.
PM2 | [nodemon] restarting due to changes...
PM2 | [nodemon] starting `npm run dev:start`
PM2 |
PM2 | > @mbl/api@0.0.1 dev:start /home/ubuntu/mbl-api
PM2 | > node --loader ts-node/esm --experimental-specifier-resolution=node --experimental-top-level-await --no-warnings src/server.ts
PM2 |
PM2 | Connected to database MONGO
PM2 | Listening to 3000
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue by running a Node.js app with PM2 and logging from the application, then compare the daemon output in pm2.log with the process's log file. Done means output from multiple processes is routed to each process's log rather than the PM2 daemon log.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100