Docs HomeMongoDB Manual

db.getLogComponents()

On this page本页内容

Definition定义

db.getLogComponents()

Returns the current verbosity settings. 返回当前详细程度设置。The verbosity settings determine the amount of Log Messages that MongoDB produces for each log message component.详细程度设置决定了MongoDB为每个日志消息组件生成的日志消息的数量。

If a component inherits the verbosity level of its parent, db.getLogComponents() displays -1 for the component's verbosity.如果组件继承其父级的详细级别,则db.getLogComponents()会显示组件详细级别的-1

Output输出

The db.getLogComponents() returns a document with the verbosity settings. db.getLogComponents()返回一个具有详细度设置的文档。For example:例如:

{
"verbosity" : 0,
"accessControl" : {
"verbosity" : -1
},
"command" : {
"verbosity" : -1
},
"control" : {
"verbosity" : -1
},
"geo" : {
"verbosity" : -1
},
"index" : {
"verbosity" : -1
},
"network" : {
"verbosity" : -1
},
"query" : {
"verbosity" : 2
},
"replication" : {
"verbosity" : -1,
"election" : {
"verbosity" : -1
},
"heartbeats" : {
"verbosity" : -1
},
"initialSync" : {
"verbosity" : -1
},
"rollback" : {
"verbosity" : -1
}
},
"sharding" : {
"verbosity" : -1
},
"storage" : {
"verbosity" : 2,
"recovery" : {
"verbosity" : -1
},
"journal" : {
"verbosity" : -1
}
},
"write" : {
"verbosity" : -1
}
}

To modify these settings, you can configure the systemLog.verbosity and systemLog.component.<name>.verbosity settings in the configuration file or set the logComponentVerbosity parameter using the setParameter command or use the db.setLogLevel() method. 要修改这些设置,可以在配置文件中配置systemLog.verbositysystemLog.component.<name>.verbosity设置,或者使用logComponentVerbosity命令或使用db.setLogLevel()方法设置logComponentVerbosity参数。For examples, see Configure Log Verbosity Levels.有关示例,请参阅配置日志详细级别