pm2 icon indicating copy to clipboard operation
pm2 copied to clipboard

pm2 logs do not print realtime on M2 Pro

Open Kye0001 opened this issue 1 year ago • 1 comments
trafficstars

Hi. I am a M2 Pro user who want to use pm2. But PM2 does not output logs in real-time on M2 Pro.

With PM2 on M2 Pro, logs are not displayed or printed in real-time, and when PM2 is killed or updated, all logs are recorded or saved to the logs file. When run with Node.js, logs within asynchronous functions are displayed in real-time. Even when running a Python file with a while loop, logs are displayed properly. However, when executed with PM2, logs are not displayed in real-time.

Here is the example logs when running Python code with pm2. The timestamp in front of the 'Loop....' message is the time displayed by the '--time' command in PM2, and the timestamp after the 'Loop....' message is the actual time when the print function is executed in Python. "Loop...." is outputted every minute.

0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:04:38.638983 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:05:38.645120 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:06:38.651345 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:07:38.657522 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:08:38.663705 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:09:38.669947 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:10:38.676165 0|Attend | 2024-03-15T11:11:50: Loop.... 2024-03-15 11:11:38.682361

Here is the info when running 'pm2 report' [PM2] Spawning PM2 daemon with pm2_home=/Users/===/.pm2 [PM2] PM2 Successfully daemonized [PM2][Module] Starting NPM module pm2-logrotate [PM2][WARN] Applications pm2-logrotate not running, starting... [PM2] App [pm2-logrotate] launched (1 instances)

--- PM2 report ----------------------------------------------------------------
Date                 : Fri Mar 15 2024 12:41:37 
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 5.3.1
node version         : 18.19.1
node path            : /Users/===/.nvm/versions/node/v18.19.1/bin/pm2
argv                 : /Users/===/.nvm/versions/node/v18.19.1/bin/node,/Users/===/.nvm/versions/node/v18.19.1/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : ===
uid                  : 501
gid                  : 20
uptime               : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 5.3.1
node version         : 18.19.1
node path            : /Users/===/.nvm/versions/node/v18.19.1/bin/pm2
argv                 : /Users/===/.nvm/versions/node/v18.19.1/bin/node,/Users/===/.nvm/versions/node/v18.19.1/bin/pm2,report
argv0                : node
user                 : ===
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : arm64
platform             : darwin
type                 : Darwin
cpus                 : Apple M2 Pro
cpus nb              : 10
freemem              : 585957376
totalmem             : 34359738368
home                 : /Users/===
===============================================================================

Kye0001 avatar Mar 15 '24 03:03 Kye0001

Which command are you using to display logs?

ultimate-tester avatar Mar 21 '24 10:03 ultimate-tester