14.3. Logging Configuration in the CLI
The Management CLI must be running and connected to the relevant JBoss EAP instance. For further information see Section 3.5.2, “Launch the Management CLI”
14.3.1. Configure the Root Logger with the CLI
- Add log handlers to the root logger.
- Display the root logger configuration.
- Change the log level.
- Remove log handlers from the root logger.
Important
/subsystem=logging/logging-profile=NAME/ instead of /subsystem=logging/.
/subsystem=logging/ with /profile=NAME/subsystem=logging/.
- Add a Log Handler to the Root Logger
- Use the
add-handleroperation with the following syntax where HANDLER is the name of the log handler to be added./subsystem=logging/root-logger=ROOT:add-handler(name="HANDLER")
The log handler must already have been created before it can be added to the root logger.Example 14.1. Root Logger add-handler operation
[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:add-handler(name="FILE") {"outcome" => "success"} - Display the Contents of the Root Logger Configuration
- Use the
read-resourceoperation with the following syntax./subsystem=logging/root-logger=ROOT:read-resource
Example 14.2. Root Logger read-resource operation
[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:read-resource { "outcome" => "success", "result" => { "filter" => undefined, "filter-spec" => undefined, "handlers" => [ "CONSOLE", "FILE" ], "level" => "INFO" } } - Set the Log Level of the Root Logger
- Use the
write-attributeoperation 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 14.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"} - Remove a Log Handler from the Root Logger
- Use the
remove-handlerwith the following syntax, where HANDLER is the name of the log handler to be removed./subsystem=logging/root-logger=ROOT:remove-handler(name="HANDLER")
Example 14.4. Remove a Log Handler
[standalone@localhost:9999 /] /subsystem=logging/root-logger=ROOT:remove-handler(name="FILE") {"outcome" => "success"}

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.