Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

logging multiple instances #24

Closed
rlidwka opened this issue Jun 25, 2013 · 0 comments
Closed

logging multiple instances #24

rlidwka opened this issue Jun 25, 2013 · 0 comments

Comments

@rlidwka
Copy link
Collaborator

rlidwka commented Jun 25, 2013

  1. When pm2 starts N instances, it outputs all errors from them to one logfile
  2. When pm2 tails these logs to stdout, it reads this logfile N times (one time per instance)

So, pm2 logs shows every line of every instance N times where N is an amount of instances.

$ cat test.js
setInterval(function() {
        console.error(process.pid);
}, 10000);

$ pm2 start test.js -i 4
⌬ PM2 Configuration :  { script: 'test.js', name: 'test', instances: '4' }
⌬ PM2 You can write the current configuration by adding -w option
⌬ PM2 Process launched
┌─────────┬────┬───────┬────────┬───────────┬──────────┬───────────────────────────────────┐
│ Script  │ id │ PID   │ status │ Restarted │ memory   │ err logs                          │
├─────────┼────┼───────┼────────┼───────────┼──────────┼───────────────────────────────────┤
│ test.js │ 3  │ 19527 │ online │ 0         │ 8.637 MB │ /home/alex/.pm2/logs/test-err.log │
├─────────┼────┼───────┼────────┼───────────┼──────────┼───────────────────────────────────┤
│ test.js │ 2  │ 19521 │ online │ 0         │ 8.637 MB │ /home/alex/.pm2/logs/test-err.log │
├─────────┼────┼───────┼────────┼───────────┼──────────┼───────────────────────────────────┤
│ test.js │ 1  │ 19515 │ online │ 0         │ 8.641 MB │ /home/alex/.pm2/logs/test-err.log │
├─────────┼────┼───────┼────────┼───────────┼──────────┼───────────────────────────────────┤
│ test.js │ 0  │ 19513 │ online │ 0         │ 8.637 MB │ /home/alex/.pm2/logs/test-err.log │
└─────────┴────┴───────┴────────┴───────────┴──────────┴───────────────────────────────────┘

$ pm2 logs
[test err (l269)] 19515
[test err (l269)] 19515 <-- duplicate
[test err (l269)] 19515 <-- duplicate
[test err (l269)] 19515 <-- duplicate
[test err (l270)] 19521
[test err (l270)] 19521 <-- duplicate
[test err (l270)] 19521 <-- duplicate
[test err (l270)] 19521 <-- duplicate
[test err (l271)] 19527
[test err (l271)] 19527 <-- duplicate
[test err (l271)] 19527 <-- duplicate
[test err (l271)] 19527 <-- duplicate
[test err (l272)] 19513
[test err (l272)] 19513 <-- duplicate
[test err (l272)] 19513 <-- duplicate
[test err (l272)] 19513 <-- duplicate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant