To view the current log verbosity levels, use the db.getLogComponents() method.
In the below mongod instance, the verbosity is 0 (default informational level). Here we can see that the verbosity of individual components are -1, this means the component inherits the log level of its parent.

We can configure log verbosity levels by

Also we can change verbosity level of an individual log component using the systemLog.component.<name>.verbosity setting for that component.
For example we are changing the verbosity level of network component to 0.
systemLog.component.network.verbosity


Example, we are going to set the default verbosity level to 2, verbosity level of storage to 1, and the storage.journal to 0
> use admin
> db.runCommand( { setParameter: 1, logComponentVerbosity:
{
verbosity: 2,
storage: {
verbosity: 1,
journal:
{
verbosity: 0
}
}
}
} )

Example:
In the below mongod instance, the verbosity is 0 (default informational level). Here we can see that the verbosity of individual components are -1, this means the component inherits the log level of its parent.
We can configure log verbosity levels by
- Method 1: Using mongod’s startup settings
- Method 2: Using the logComponentVerbosity parameter
- Method 3: Using the db.setLogLevel() method.
Method 1:
We can configure global verbosity level using: the systemLog.verbosity settingsAlso we can change verbosity level of an individual log component using the systemLog.component.<name>.verbosity setting for that component.
For example we are changing the verbosity level of network component to 0.
systemLog.component.network.verbosity
Method 2:
To change log verbosity level using the logComponentVerbosity parameter, pass a document with the required verbosity settings.Example, we are going to set the default verbosity level to 2, verbosity level of storage to 1, and the storage.journal to 0
> use admin
> db.runCommand( { setParameter: 1, logComponentVerbosity:
{
verbosity: 2,
storage: {
verbosity: 1,
journal:
{
verbosity: 0
}
}
}
} )
Method 3:
We can use the db.setLogLevel() method to update a single component’s log level.Example:
No comments:
Post a Comment