node.js - 无法禁用以下 express:* 相关 pm2 日志?
问题描述
我想从使用 pm2 运行的 express 代码中禁用一些日志(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
- 不工作。
解决方案
我设法通过添加以下环境 var process.env.DEBUG=false 来完成它
推荐阅读
- python - 关于在 Python Numpy 和 Pandas 的同一列中添加带有循环的索引
- r - 选择大量列来重新编码变量值
- c++ - virtual 关键字会影响基类方法的性能吗?
- excel - 来自多个工作表的 VBA 索引/匹配
- python - 检查数组中的 n 个元素是否在增加
- javascript - 未捕获的 TypeError:无法设置 null 错误的属性“innerHTML”,但元素不为 null
- python - 限制我的 HTML 页面中的用户表单输入,直到我的 Python 函数完成运行,Flask
- sql - 将相关表中的值转换为逗号分隔的列表
- c - 用于数组初始化的 C 宏
- pandas - 如何从 Pandas 数据框中获取一组值?