Unitech / Unitech/pm2

DOC: confusing docs about combined log file

Open
#4,388 4 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What's going wrong?

I discovered this default behavior of PM2 by trial and error:

  1. -out logs and -err logs will default to output in ~/.pm2/logs, unless and only unless they are rerouted or disabled via configuration or CLI.
  2. In addition to -out and -err logs you can create a combined log. Creating a combined log does not override or disable -out logs or -err logs. But unless it is configured a combined log is not produced.

How could we reproduce this issue?

Supporting information

Simple fix idea:

modules.exports = [{
  script: 'echo.js',
  error_file: 'err.log',      // PM2 will always output a -err file, unless you disable
  out_file: 'out.log',        // PM2 will always output a -out log unless you disable
  log_file: 'combined.log',   // PM2 will not output a combined file unless configured
  time: true
}]
--- PM2 report ----------------------------------------------------------------
Date                 : Mon Aug 12 2019 15:46:53 GMT-0700 (PDT)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version         : 3.5.1
node version         : 8.15.1
node path            : /Users/brucejo/.nvm/versions/node/v8.15.1/lib/node_modules/pm2/bin/pm2
argv                 : /Users/brucejo/.nvm/versions/node/v8.15.1/bin/node,/Users/brucejo/.nvm/versions/node/v8.15.1/lib/node_modules/pm2/lib/Daemon.js
argv0                : node
user                 : undefined
uid                  : 0
gid                  : 0
uptime               : 4360min
===============================================================================
--- CLI ----------------------------------------------------
local pm2            : 3.5.1
node version         : 8.15.1
node path            : /Users/brucejo/.nvm/versions/node/v8.15.1/bin/pm2
argv                 : /Users/brucejo/.nvm/versions/node/v8.15.1/bin/node,/Users/brucejo/.nvm/versions/node/v8.15.1/bin/pm2,report
argv0                : node
user                 : brucejo
uid                  : 501
gid                  : 20
===============================================================================
--- System info --------------------------------------------
arch                 : x64
platform             : darwin
type                 : Darwin
cpus                 : Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
cpus nb              : 4
freemem              : 6981689344
totalmem             : 17179869184
home                 : /Users/brucejo
===============================================================================
--- PM2 list -----------------------------------------------
┌───────┬────┬──────┬────────┬───┬─────┬────────────┐
│ Name  │ id │ mode │ status │ ↺ │ cpu │ memory     │
├───────┼────┼──────┼────────┼───┼─────┼────────────┤
│ app   │ 12 │ fork │ online │ 0 │ 0%  │ 130.2 MB   │
│ meris │ 11 │ fork │ online │ 0 │ 0%  │ 129.1 MB   │
└───────┴────┴──────┴────────┴───┴─────┴────────────┘
Module
┌───────────────┬────┬────────┬─────┬────────────┐
│ Module        │ id │ status │ cpu │ mem        │
├───────────────┼────┼────────┼─────┼────────────┤
│ pm2-logrotate │ 0  │ online │ 0%  │ 104.0 MB   │
└───────────────┴────┴────────┴─────┴────────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/brucejo/.pm2/pm2.log last 20 lines:
PM2        | 2019-08-12T14:23:16: PM2 log: Stopping app:meris id:1
PM2        | 2019-08-12T14:23:16: PM2 log: Stopping app:app id:2
PM2        | 2019-08-12T14:23:16: PM2 log: App [app:2] exited with code [0] via signal [SIGINT]
PM2        | 2019-08-12T14:23:16: PM2 log: App [meris:1] exited with code [0] via signal [SIGINT]
PM2        | 2019-08-12T14:23:16: PM2 log: pid=80313 msg=process killed
PM2        | 2019-08-12T14:23:16: PM2 log: pid=80314 msg=process killed
PM2        | 2019-08-12T14:23:41: PM2 log: App [meris:9] starting in -fork mode-
PM2        | 2019-08-12T14:23:41: PM2 log: App [app:10] starting in -fork mode-
PM2        | 2019-08-12T14:23:41: PM2 log: App [meris:9] online
PM2        | 2019-08-12T14:23:41: PM2 log: App [app:10] online
PM2        | 2019-08-12T14:30:14: PM2 log: Stopping app:meris id:9
PM2        | 2019-08-12T14:30:14: PM2 log: Stopping app:app id:10
PM2        | 2019-08-12T14:30:14: PM2 log: App [meris:9] exited with code [0] via signal [SIGINT]
PM2        | 2019-08-12T14:30:14: PM2 log: App [app:10] exited with code [0] via signal [SIGINT]
PM2        | 2019-08-12T14:30:14: PM2 log: pid=76538 msg=process killed
PM2        | 2019-08-12T14:30:14: PM2 log: pid=76539 msg=process killed
PM2        | 2019-08-12T14:30:21: PM2 log: App [meris:11] starting in -fork mode-
PM2        | 2019-08-12T14:30:21: PM2 log: App [app:12] starting in -fork mode-
PM2        | 2019-08-12T14:30:21: PM2 log: App [meris:11] online
PM2        | 2019-08-12T14:30:21: PM2 log: App [app:12] 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

Review the PM2 log-management documentation sections linked in the issue, especially ecosystem, disable logging, and CLI configuration. Update the explanation and example so the default -out and -err logs are distinguished from the separately configured combined log, then verify the documented behavior against the stated configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.