node: 12.13.0
pm2: 4.2.3
The issue is where nothing is printed in pm2-out and pm2-err log files instead of a few lines that pm2 prints the script which is executing. I tried both with Winston and Debug loggers. When I start in fork mode all logs are printed. Also, pm2 logs
show the logs but files are empty.
I use merge_logs
to avoid splitting out or err logs into multiple files per process.
I also tried with specifying log names but without luck. If anyone can help me, thank you in advance.
PS I don't want to use Winston output to file. Also, with pm2 monit
I don't see anything.
ecosystem.config.js :
module.exports = {
apps: [
{
name: 'client',
script: 'npm',
args: 'run start:client',
cwd: '/mnt/data/app',
watch: false,
log_date_format: 'DD-MM-YYYY HH:mm',
exec_mode: 'cluster',
instances: '2',
merge_logs: true,
env: {
PORT: 8080,
NODE_ENV: 'production',
},
},
{
name: 'server',
script: 'npm',
args: 'run start:server',
cwd: '/mnt/data/app',
watch: false,
log_date_format: 'DD-MM-YYYY HH:mm',
exec_mode: 'cluster',
instances: '2',
merge_logs: true,
env: {
PORT: 3000,
NODE_ENV: 'production',
},
},
],
};
run this command pm2 install pm2-intercom
might work without this &
then add pm2: true
in log4js config like the following :
log4js.configure({
appenders: {
out: {
type: 'stdout'
}
},
categories: {
default: {
appenders: ['out'],
level: 'info'
}
},
pm2: true
});
for more details, refer https://github.com/log4js-node/log4js-node/blob/master/docs/clustering.md
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.