Issues with configuring log path
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
OS: Ubuntu 14.04.2 LTS (on AWS)
Node version: 0.12.7
PM2 version: 0.14.5
Command: pm2 start ./bin/www.js -i -1 --name='process-name' --merge-logs -logs='/var/www/root/process-name/bin/logs' --log-date-format='YYYY-MM-DD HH:mm Z'
For what it's worth, this is in the "start" section of my package.json, so I'm calling the command via npm start. (Hence the single quotes.)
The end result of this command is that logs go... nowhere. They don't show up in either the default or expected directory.
Running pm2 show process-name gave me the following interesting table.
│ exec cwd │ /var/www/root/process-name │
│ entire log path │ /var/www/root/process-name/bin/logs │
│ error log path │ /home/ubuntu/.pm2/logs/process-name-error.log │
│ out log path │ /home/ubuntu/.pm2/logs/process-name-out.log |
If I set these things more manually (--output='/var/www/root/project-name/bin/logs/output.log'), then the paths get updated correctly in the pm2 show table, the "entire log path" variable doesn't show up, and the files go where they should:
│ exec cwd │ /var/www/root/process-name │
│ error log path │ /var/www/root/process-name/bin/logs/error.log │
│ out log path │ /var/www/root/process-name/bin/logs/out.log
Though I'm not sure how this manually-listed log file name will work with pm2-logrotate... I haven't seen a datestamp in a filename yet.
Also, if I try to list only the path, as the documentation kind of indicates I should (--output='/var/www/root/project-name/bin/logs/'), I get this table:
│ exec cwd │ /var/www/root/process-name │
│ error log path │ /var/www/root/process-name/bin/logs │
│ out log path │ /var/www/root/process-name/bin/logs |
and the files go back to not showing up either in the specified folder or the default one.
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
Start by reproducing the reported npm-start command with PM2 0.14.5 and inspect the output of pm2 show process-name. Compare --merge-logs and --logs with explicit --output paths, then check the documented path syntax and pm2-logrotate behavior. Done means the chosen log path consistently receives the logs and its expected interaction with rotation is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, observability
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100