node.js - 如何在控制台中禁用 Node mongodb-native 驱动程序连接日志记录

标签 node.js mongodb logging message

当我启动连接到 mongodb 的 Node 服务器时,我总是收到这些消息,告诉我连接的状态。如何禁用这些消息?

Wed Apr 24 13:28:17 [initandlisten] connection accepted from 127.0.0.1:55221 #304 (1 connection now open)
Wed Apr 24 13:28:17 [initandlisten] connection accepted from 127.0.0.1:55222 #305 (2 connections now open)
Wed Apr 24 13:28:17 [initandlisten] connection accepted from 127.0.0.1:55223 #306 (3 connections now open)
Wed Apr 24 13:28:17 [initandlisten] connection accepted from 127.0.0.1:55224 #307 (4 connections now open)
Wed Apr 24 13:28:17 [initandlisten] connection accepted from 127.0.0.1:55225 #308 (5 connections now open)
Wed Apr 24 13:35:42 [conn308] end connection 127.0.0.1:55225 (4 connections now open)
Wed Apr 24 13:35:42 [conn307] end connection 127.0.0.1:55224 (4 connections now open)
Wed Apr 24 13:35:42 [conn306] end connection 127.0.0.1:55223 (4 connections now open)
Wed Apr 24 13:35:42 [conn305] end connection 127.0.0.1:55222 (4 connections now open)
Wed Apr 24 13:35:42 [conn304] end connection 127.0.0.1:55221 (4 connections now open)

最佳答案

此消息不是来自node.js 或node-mongodb-native 驱动程序。它来自 mongo 守护进程。

启动 mongo 时,只需传递 --quiet 选项,此消息就会消失。

关于node.js - 如何在控制台中禁用 Node mongodb-native 驱动程序连接日志记录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16200719/

相关文章:

mysql - NodeJS MySQL 撇号重复与 INSERT 查询

javascript - Node 在 console.log() 之后用 JavaScript 字典打印 undefined

mongodb - MongoDB 中的 $unwind 运算符是什么?

gwt - 在 GWT 中设置 remoteLoggingServlet

java - 如何将 System.out、System.err 重定向到日志文件

python - 气刹 throw 错误 "pybrake - ERROR - strconv.ParseInt: parsing "无“: invalid syntax"

javascript - 适用于 Node.js 和浏览器的模块系统?

javascript - Mongoose - 如何处理许多错综复杂的关系?下面包含特定的快速挑战示例请求。谢谢

java - REST POST 到 Java 应用程序返回 JSON 响应,其中某些字段为 null

mysql - PostgreSQL 还是 MySQL 更受 Node.js 欢迎?