Unitech / Unitech/pm2

Updating a console line create a new line in live log

Open
#4,806 0 comments 0 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?

Maybe not a bug but I can't find a way to update a line in the console. It works well in the normal node.js console but as soon as I start it with pm2 and look a the live logs (with pm2 logs), a new line is created instead of updating the current one.

How could we reproduce this issue?

Simply run the code example from this log-update package or any code from this SO question

Supporting information

--- PM2 report ----------------------------------------------------------------
Date                 : Sun Aug 09 2020 16:54:34 GMT+0200 (GMT+02:00)
===============================================================================
--- Daemon --------------------------------------------------------------------
pm2d version         : 4.4.0
node version         : 12.18.1
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\HP\AppData\Roaming\npm\node_modules\pm2\lib\Daemon.js
argv0                : node
user                 : undefined
uid                  : N/A
gid                  : N/A
uptime               : 0min
===============================================================================
--- CLI -----------------------------------------------------------------------
local pm2            : 4.4.0
node version         : 12.18.1
node path            : not found
argv                 : C:\Program Files\nodejs\node.exe,C:\Users\HP\AppData\Roaming\npm\node_modules\pm2\bin\pm2,report
argv0                : node
user                 : HP
===============================================================================
--- System info ---------------------------------------------------------------
arch                 : x64
platform             : win32
type                 : Windows_NT
cpus                 : Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz
cpus nb              : 8
freemem              : 8761098240
totalmem             : 17019641856
home                 : C:\Users\HP
===============================================================================
--- PM2 list ------------------------------------------------------------------
┌─────┬─────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id  │ name    │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├─────┼─────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0   │ test    │ default     │ 1.0.0   │ fork    │ 14088    │ 10s    │ 0    │ online    │ 7.5%     │ 33.4mb   │ HP       │ disabled │
└─────┴─────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs ---------------------------------------------------------------
C:\Users\HP\.pm2\pm2.log last 20 lines:
PM2        | 2020-08-01T18:35:01: PM2 log: App [logUpdateTest:0] exited with code [1] via signal [SIGINT]
PM2        | 2020-08-01T18:35:01: PM2 log: pid=2720 msg=process killed
PM2        | 2020-08-09T16:54:23: PM2 log: ===============================================================================
PM2        | 2020-08-09T16:54:23: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2        | 2020-08-09T16:54:23: PM2 log: Time                 : Sun Aug 09 2020 16:54:23 GMT+0200 (GMT+02:00)
PM2        | 2020-08-09T16:54:23: PM2 log: PM2 version          : 4.4.0
PM2        | 2020-08-09T16:54:23: PM2 log: Node.js version      : 12.18.1
PM2        | 2020-08-09T16:54:23: PM2 log: Current arch         : x64
PM2        | 2020-08-09T16:54:23: PM2 log: PM2 home             : C:\Users\HP\.pm2
PM2        | 2020-08-09T16:54:23: PM2 log: PM2 PID file         : C:\Users\HP\.pm2\pm2.pid
PM2        | 2020-08-09T16:54:23: PM2 log: RPC socket file      : \\.\pipe\rpc.sock
PM2        | 2020-08-09T16:54:23: PM2 log: BUS socket file      : \\.\pipe\pub.sock
PM2        | 2020-08-09T16:54:23: PM2 log: Application log path : C:\Users\HP\.pm2\logs
PM2        | 2020-08-09T16:54:23: PM2 log: Worker Interval      : 30000
PM2        | 2020-08-09T16:54:23: PM2 log: Process dump file    : C:\Users\HP\.pm2\dump.pm2
PM2        | 2020-08-09T16:54:23: PM2 log: Concurrent actions   : 2
PM2        | 2020-08-09T16:54:23: PM2 log: SIGTERM timeout      : 1600
PM2        | 2020-08-09T16:54:23: PM2 log: ===============================================================================
PM2        | 2020-08-09T16:54:23: PM2 log: App [test:0] starting in -fork mode-
PM2        | 2020-08-09T16:54:23: PM2 log: App [test:0] online

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 behavior with the linked log-update example under normal Node.js output and then with PM2 using pm2 logs on the reported Windows setup. Trace how live logs handle carriage returns or other line updates, and consider the issue done when the same console update remains on one live-log line instead of creating new lines.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.