不能禁用以下express:*相关的pm2日志?

时间:2018-10-12 10:06:28

标签: node.js express pm2 pm2-logrotate

我想禁用一些使用pm2运行的快速代码的日志(express:router)。 当前日志如下

GMT express:router dispatching GET /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT express:router query  : /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT express:router expressInit  : /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT express:router corsMiddleware  : /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT express:router jsonParser  : /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT body-parser:json skip empty body
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT express:router urlencodedParser  : /healthcheck
10|consumer  | Wed, 10 Oct 2018 19:40:04 GMT body-parser:urlencoded skip empty body
  • 我将/dev/null传递给error_file或out_file以禁用日志保存- 不起作用,我仍然可以看到日志
  • Run pm2 using command - pm2 start consumer -o "/dev/null" -e "/dev/null" - Not works.
  • 我使用DEBUG=express.* node index.js运行它-没用。

1 个答案:

答案 0 :(得分:0)

我设法通过添加以下环境变量来完成它 process.env.DEBUG = false