Reputation: 51
If I am running pm2 process for node js app in fork mode , The logs are getting generated but same app is not giving logs if running in pm2 cluster mode
I am using the below pm2 ecosystem file to start my app
module.exports = {
apps : [
{
name: 'test',
script: <entry_file_path>,
exec_mode: "cluster",
instances: 1,
autorestart: true,
watch: false,
combine_logs:true,
max_memory_restart: '1G',
exp_backoff_restart_delay: 1000,
merge_logs: true,
env: {
NODE_ENV: 'production'
}
}]
};
I am using log4js v5.2.2 for logging in my node app
Upvotes: 1
Views: 1743
Reputation: 51
Based on suggestion of @MAS below configuration worked for me
run this command "pm2 install pm2-intercom" & then add pm2: true in log4js config
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
Upvotes: 3