13.3. Logging Configuration in the CLI

13.3.1. Configure the Root Logger with the CLI

The root logger configuration can be viewed and edited using the CLI.
The main tasks you will perform to configuration the root logger are:
  • Add log handlers to the root logger.
  • Display the root logger configuration.
  • Change the log level.
  • Remove log handlers from the root logger.

Important

When configuring a root logger in a logging profile the root of the configuration path is /subsystem=logging/logging-profile=NAME/ instead of /subsystem=logging/.
Add a Log Handler to the Root Logger
Use the root-logger-assign-handler operation with the following syntax where HANDLER is the name of the log handler to be added.
 /subsystem=logging/root-logger=ROOT:root-logger-assign-handler(name="HANDLER") 
The log handler must already have been created before it can be added to the root logger.

Example 13.1. Root Logger root-logger-assign-handler operation

[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:root-logger-assign-handler(name="AccountsNFSAsync")
{"outcome" => "success"}
[standalone@localhost:9999 /]
Display the Contents of the Root Logger Configuration
Use the read-resource operation with the following syntax.
 /subsystem=logging/root-logger=ROOT:read-resource 

Example 13.2. Root Logger read-resource operation

[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:read-resource                                  
{
   "outcome" => "success",
   "result" => {
      "filter" => {"match" => "names"},
      "handlers" => [
            "CONSOLE",
            "FILE"
      ],
      "level" => "INFO"
   }
}
Set the Log Level of the Root Logger
Use the write-attribute operation with the following syntax where LEVEL is one of the supported log levels.
 /subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="LEVEL") 

Example 13.3. Root Logger write-attribute operation to set the log level

[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="DEBUG")
{"outcome" => "success"}
[standalone@localhost:9999 /]
Remove a Log Handler from the Root Logger
Use the root-logger-unassign-handler with the following syntax, where HANDLER is the name of the log handler to be removed.
 /subsystem=logging/root-logger=ROOT:root-logger-unassign-handler(name="HANDLER") 

Example 13.4. Remove a Log Handler

[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:root-logger-unassign-handler(name="AccountsNFSAsync")
{"outcome" => "success"}
[standalone@localhost:9999 /]