pm2 ignores log_date_format
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 set in ecosystem:
log_date_format: 'YYYY-MM-DD HH:mm Z'
also I tried other formats, pm2 ignores all
But in env:
log_date_format: YYYY-MM-DDTHH:mm:ss
And in logs:
18|pm2-debug | 2022-10-16T09:46:08: 2022-10-16T09:46:08.689Z
18|pm2-debug | 2022-10-16T09:46:09: 2022-10-16T09:46:09.689Z
How could we reproduce this issue?
pm2 start pm2.config.yml
pm2 env <id> | grep log
log_date_format: YYYY-MM-DDTHH:mm:ss
Also i tried run from console, same result
pm2 start index.js --name pm2-debug --time --log-date-format "YYYY-MM-DD HH:mm Z"
index.js
var myInt = setInterval(function () {
console.log(new Date().toISOString());
}, 1000);
pm2.config.yml
apps:
- name: 'pm2-debug'
script: 'index.js'
cwd: '/var/web/pm2-debug'
instances: '1'
exec_mode: 'cluster'
time: true
log_date_format: 'YYYY-MM-DD HH:mm Z'
error_file: './error.log'
out_file: './access.log'
env:
NODE_ENV: 'production'
HOST: '127.0.0.1'
PORT: '30100'
umask: '0002'
Supporting information
pm2 report
--- PM2 report ----------------------------------------------------------------
Date : Sun Oct 16 2022 09:27:52 GMT+0000 (Всемирное координированное время)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 5.2.2
node version : 16.17.1
node path : not found
argv : /usr/bin/node,/usr/lib/node_modules/pm2/lib/Daemon.js
argv0 : node
user : root
uid : 0
gid : 0
uptime : 39min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 5.2.2
node version : 16.17.1
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) E-2386G CPU @ 3.50GHz
cpus nb : 6
freemem : 5208940544
totalmem : 8342847488
home : /root
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬────────────────────────────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
├─────┼────────────────────────────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
└─────┴────────────────────────────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
Module
┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐
│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │
├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤
│ 0 │ pm2-logrotate │ 2.7.0 │ 1175075 │ online │ 0 │ 0.1% │ 57.4mb │ root │
└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/root/.pm2/pm2.log last 20 lines:
PM2 | 2022-10-16T08:48:24: PM2 log: App [pm2-debug:15] starting in -cluster mode-
PM2 | 2022-10-16T08:48:24: PM2 log: App [pm2-debug:15] online
PM2 | 2022-10-16T08:55:02: PM2 log: Stopping app:pm2-debug id:15
PM2 | 2022-10-16T08:55:02: PM2 log: App name:pm2-debug id:15 disconnected
PM2 | 2022-10-16T08:55:02: PM2 log: App [pm2-debug:15] exited with code [0] via signal [SIGINT]
PM2 | 2022-10-16T08:55:02: PM2 log: pid=1175275 msg=process killed
PM2 | 2022-10-16T09:22:48: PM2 log: App [index:16] starting in -fork mode-
PM2 | 2022-10-16T09:22:48: PM2 log: App [index:16] online
PM2 | 2022-10-16T09:24:03: PM2 log: Stopping app:index id:16
PM2 | 2022-10-16T09:24:03: PM2 log: App [index:16] exited with code [0] via signal [SIGINT]
PM2 | 2022-10-16T09:24:03: PM2 log: pid=1175465 msg=process killed
PM2 | 2022-10-16T09:24:17: PM2 log: App [pm2-debug:17] starting in -fork mode-
PM2 | 2022-10-16T09:24:17: PM2 log: App [pm2-debug:17] online
PM2 | 2022-10-16T09:25:34: PM2 log: Stopping app:pm2-debug id:17
PM2 | 2022-10-16T09:25:34: PM2 log: App [pm2-debug:17] exited with code [0] via signal [SIGINT]
PM2 | 2022-10-16T09:25:34: PM2 log: pid=1175536 msg=process killed
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 report with index.js and pm2.config.yml using the shown pm2 start commands, then inspect the PM2 entry point that applies log_date_format. Compare the configured format with the emitted log prefix and verify that the requested format is honored in the resulting logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100