[英]Not getting any logs for node process running through pm2 in cluster mode
如果我在 fork 模式下為 node js 應用程序運行 pm2 進程,日志正在生成,但如果在 pm2 集群模式下運行,相同的應用程序不會提供日志
我正在使用下面的 pm2 生態系統文件來啟動我的應用程序
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'
}
}]
};
我正在使用 log4js v5.2.2 登錄我的節點應用程序
根據@MAS 的建議,以下配置對我有用
運行此命令“pm2 install pm2-intercom”,然后在 log4js 配置中添加 pm2: true
log4js.configure({
appenders: { out: { type: 'stdout'}},
categories: { default: { appenders: ['out'], level: 'info'}},
pm2: true
});
有關更多詳細信息,請參閱https://github.com/log4js-node/log4js-node/blob/master/docs/clustering.md
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.