11.3. Logging Configuration in the CLI

11.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:
  • Display the root logger configuration.
  • Change the log level.
  • Add log handlers to the root logger.
  • Remove log handlers from the root logger.
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 11.1. 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 11.2. 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 /]
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 11.3. 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 /]
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 11.4. Remove a Log Handler

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