pm2-gui icon indicating copy to clipboard operation
pm2-gui copied to clipboard

pm2-gui message can be classified according to different app to display it?

Open songhongjiang opened this issue 8 years ago • 3 comments

pm2-gui message can be classified according to different app to display it? for example now i have two apps, pm2-redis and pm2-mongodb, the pm2-gui display message as follow 2017-11-24 18:28:09: App [pm2-redis] with id [0] and pid [101116], exited with code [0] via signal [SIGINT] 2017-11-24 18:28:10: App [pm2-mongodb] with id [1] and pid [101975], exited with code [0] via signal [SIGINT]

Can pm2-gui display App [pm2-redis] message when i select pm2-redis and display App [pm2-mongodb] messagewhen i select pm2-mongodb? or what can i do? thank you!

songhongjiang avatar Nov 24 '17 10:11 songhongjiang

gotcha, the logs actually from pm2.log but not the [app].log.

its a good idea to grep logs by app name from pm2.log and do not display others

Tjatse avatar Nov 28 '17 04:11 Tjatse

what should i do?thank you

songhongjiang avatar Nov 30 '17 10:11 songhongjiang

in terminal, use commnd ‘tail -f /root/.pm2/pm2.log | grep --line-buffered "pm2-redis"’ ,i can get the log info by app name but how to modify the source 'pm._tailLogs = function (proc, cb) { ' in the file /lib/pm2.js , now: var tail = spawn('tail', ['-n', 20, '-f'].concat(logFiles), { killSignal: 'SIGTERM', detached: true, stdio: ['ignore', 'pipe', 'pipe'] })

modify: var tail = spawn('tail', ['-n', 20, '-f'].concat(logFiles), { killSignal: 'SIGTERM', detached: true, stdio: ['ignore', 'pipe', 'pipe'] }) var grep = spawn('grep', ['--line-buffered'].concat(# appname), { killSignal: 'SIGTERM', detached: true, stdio: [tail.stdout, 'pipe', 'pipe'] })

but how can i get the app name

Thank you!

songhongjiang avatar Dec 01 '17 03:12 songhongjiang