Unitech / Unitech/pm2

pm2 can't start express project with option --log

Open
#2,553 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3: Medium S: Icebox
Dominant language
JavaScript
Stars
43.3k
Forks
2.7k
PR merge metrics
No merged PRs in 30d

Description

use relative path
vagrant@vagrant-ubuntu-trusty-64:~/app$ ./node_modules/pm2/bin/pm2 start index.js --name example --log ~/logs/

[PM2] Starting /home/vagrant/app/index.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
use absolute path
vagrant@vagrant-ubuntu-trusty-64:~/app$ ./node_modules/pm2/bin/pm2 start index.js --name example --log /home/vagrant/logs/

[PM2] Starting /home/vagrant/app/index.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
after set path mode 777
drwxrwxrwx 2 vagrant vagrant 4096 Dec  2 08:17 logs/

vagrant@vagrant-ubuntu-trusty-64:~/app$ ./node_modules/pm2/bin/pm2 start index.js --name example --log ~/logs
[PM2] Starting /home/vagrant/app/index.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app
vagrant@vagrant-ubuntu-trusty-64:~/app$ ./node_modules/pm2/bin/pm2 start index.js --name example --log /home/vagrant/logs/
[PM2] Starting /home/vagrant/app/index.js in fork_mode (1 instance)
[PM2] Done.
┌──────────┬────┬──────┬─────┬────────┬─────────┬────────┬─────┬─────┬──────────┐
│ App name │ id │ mode │ pid │ status │ restart │ uptime │ cpu │ mem │ watching │
└──────────┴────┴──────┴─────┴────────┴─────────┴────────┴─────┴─────┴──────────┘
 Use `pm2 show <id|name>` to get more details about an app

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

Reproduce the reported behavior with ./node_modules/pm2/bin/pm2, index.js, and the --log option using both relative and absolute log-directory paths. Trace how the CLI handles those paths and establish the expected result; the issue is complete when both forms reliably produce the intended logs, with regression coverage if an existing test entry point is found.

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
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.