On this page本页内容
db.setLogLevel()
Sets a single verbosity level for log messages.为日志消息设置单个详细级别。
db.setLogLevel()
has the following form:具有以下形式:
db.setLogLevel(<level>, <component>)
db.setLogLevel()
takes the following parameters:采用以下参数:
level | int |
|
component | string |
|
db.setLogLevel()
sets a single verbosity level. 设置单个详细级别。To set multiple verbosity levels in a single operation, use either the 要在单个操作中设置多个详细级别,请使用setParameter
command to set the logComponentVerbosity
parameter. setParameter
命令设置logComponentVerbosity
参数。You can also specify the verbosity settings in the configuration file. 您还可以在配置文件中指定详细设置。See Configure Log Verbosity Levels for examples.有关示例,请参阅配置日志详细级别。
Starting in version 4.2, MongoDB includes the Debug verbosity level (1-5) in the log messages. 从4.2版开始,MongoDB在日志消息中包含调试详细级别(1-5)。For example, if the verbosity level is 2, MongoDB logs 例如,如果详细级别为2,则MongoDB将记录D2
. D2
。In previous versions, MongoDB log messages only specified 在以前的版本中,MongoDB日志消息仅将调试级别指定为D
for Debug level.D
。
Omit the 省略<component>
parameter to set the default verbosity for all components; i.e. the systemLog.verbosity
setting. <component>
参数以设置所有组件的默认详细程度;即systemLog.verbosity
设置。The operation sets the default verbosity to 该操作将默认详细程度设置为1
:1
:
db.setLogLevel(1)
Specify the 指定<component>
parameter to set the verbosity for the component. <component>
参数以设置组件的详细程度。The following operation updates the 以下操作将systemLog.component.storage.journal.verbosity
to 2
:systemLog.component.storage.journal.verbosity
更新为2
:
db.setLogLevel(2, "storage.journal" )