[英]MongoDB: How to log all queries to log file on Windows
This Questions could not help me: MongoDB logging all queries这个问题对我没有帮助: MongoDB 记录所有查询
Here is my configuration file:这是我的配置文件:
dbpath = C:\mongodb\data
logpath = C:\mongodb\mongo.log
diaglog = 3
profile = 2
slowms = 1
but my log file contains no queries.但我的日志文件不包含任何查询。 What I'm doing wrong?
我做错了什么?
PS: I'm using mongodb version v3.2.3 PS:我使用的是 mongodb 版本 v3.2.3
You have two options to increase your log verbosity.您有两个选项可以增加日志详细程度。
Increase your log verbosity in configuration file.增加配置文件中的日志详细程度。 systemLog.component.query.verbosity = 4 see systemLog.component.query.verbosity documentation
systemLog.component.query.verbosity = 4 参见systemLog.component.query.verbosity文档
db.setLogLevel(...) see setLogLevel documentation. db.setLogLevel(...) 请参阅setLogLevel文档。
your final config file should look like你的最终配置文件应该看起来像
storage:
dbPath: "C:\mongodb\data"
systemLog:
destination: file
path: "C:\mongodb\mongo.log"
component:
query:
verbosity: 2
operationProfiling:
slowOpThresholdMs: 100
mode: slowOp
从 mongo shell 连接并运行:db.setLogLevel(2,"query")
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.