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-1for the component's verbosity.db.getLogComponents()将显示该组件的详细程度为-1。
Compatibility兼容性
This method is available in deployments hosted in the following environments:此方法在以下环境中托管的部署中可用:
- MongoDB Atlas
: The fully managed service for MongoDB deployments in the cloud:云中MongoDB部署的完全托管服务
Important
This command is not supported in M0 and Flex clusters. For more information, see Unsupported Commands.M0和Flex集群不支持此命令。有关详细信息,请参阅不支持的命令。
- MongoDB Enterprise
: The subscription-based, self-managed version of MongoDB:MongoDB的基于订阅的自我管理版本 - MongoDB Community
: The source-available, free-to-use, and self-managed version of MongoDB:MongoDB的源代码可用、免费使用和自我管理版本
Output输出
The db.getLogComponents() returns a document with the verbosity settings. For example:db.getLogComponents()返回一个包含详细度设置的文档。例如:
{
"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.verbosity和systemLog.component.<name>.verbosity设置,或使用setParameter命令设置logComponentVerbosity参数,或使用db.setLogLevel()方法。For examples, see Configure Log Verbosity Levels.有关示例,请参阅配置日志详细程度级别。