14.3.7. Configure a Async Log Handler in the CLI

Async log handlers can be added, removed and edited in the CLI.
The tasks you will perform to configure an async log handler are:
  • Add a new async log handler
  • Display the configuration of an async log handler
  • Change the log level
  • Set the queue length
  • Set the overflow action
  • Add sub-handlers
  • Remove sub-handlers
  • Remove an async log handler
Each of these tasks are described below.

Important

When configuring a log handler in a logging profile for a standalone system, the root of the configuration path is /subsystem=logging/logging-profile=NAME/ instead of /subsystem=logging/.
For a managed domain, you must specify which profile to use. You must add the profile name to the beginning of the configuration path for a managed domain, replacing /subsystem=logging/ with /profile=NAME/subsystem=logging/.
Add a new async log handler
Use the add operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:add(queue-length="LENGTH") 
Replace HANDLER with the name of the log handler. Replace LENGTH with value of the maximum number of log requests that can be held in queue.

Example 14.51. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:add(queue-length="10")
{"outcome" => "success"}
Display the configuration of an async log handler
Use the read-resource operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:read-resource 
Replace HANDLER with the name of the log handler.

Example 14.52. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:read-resource
{
    "outcome" => "success",
    "result" => {
        "encoding" => undefined,
        "filter" => undefined,
        "formatter" => "%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%E%n",
        "level" => undefined,
        "overflow-action" => "BLOCK",
        "queue-length" => "50",
        "subhandlers" => undefined
    }
}
[standalone@localhost:9999 /]
Change the log level
Use the write-attribute operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:write-attribute(name="level", value="LOG_LEVEL_VALUE") 
Replace HANDLER with the name of the log handler. Replace LOG_LEVEL_VALUE with the log level that is to be set.

Example 14.53. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:write-attribute(name="level", value="INFO")
{"outcome" => "success"}
[standalone@localhost:9999 /]
Set the queue length
Use the write-attribute operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:write-attribute(name="queue-length", value="LENGTH") 
Replace HANDLER with the name of the log handler. Replace LENGTH with value of the maximum number of log requests that can be held in queue.
JBoss EAP 6 must be restarted for this change to take effect.

Example 14.54. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:write-attribute(name="queue-length", value="150")
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}
Set the overflow action
Use the write-attribute operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:write-attribute(name="overflow-action", value="ACTION") 
Replace HANDLER with the name of the log handler. Replace ACTION with either DISCARD or BLOCK.

Example 14.55. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:write-attribute(name="overflow-action", value="DISCARD")
{"outcome" => "success"}
[standalone@localhost:9999 /]
Add sub-handlers
Use the add-handler operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:add-handler(name="SUBHANDLER") 
Replace HANDLER with the name of the log handler. Replace SUBHANDLER with the name of the log handler that is to be added as a sub-handler of this async handler.

Example 14.56. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:add-handler(name="NFS_FILE")       
{"outcome" => "success"}
[standalone@localhost:9999 /]
Remove sub-handlers
Use the remove-handler operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:remove-handler(name="SUBHANDLER")
Replace HANDLER with the name of the log handler. Replace SUBHANDLER with the name of the sub-handler to remove.

Example 14.57. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:remove-handler(name="NFS_FILE")       
{"outcome" => "success"}
[standalone@localhost:9999 /]
Remove an async log handler
Use the remove operation with the following syntax.
/subsystem=logging/async-handler=HANDLER:remove 
Replace HANDLER with the name of the log handler.

Example 14.58. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:remove       
{"outcome" => "success"}
[standalone@localhost:9999 /]