13.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 the root of the configuration path is /subsystem=logging/logging-profile=NAME/ instead of /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 13.50. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:add(queue-length="10")
{"outcome" => "success"}
[standalone@localhost:9999 /]
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 13.51. 

[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 change-log-level operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:change-log-level(level="LEVEL") 
Replace HANDLER with the name of the log handler. Replace LEVEL with the log level that is to be set.

Example 13.52. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:change-log-level(level="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 13.53. 

[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"
    }
}
[standalone@localhost:9999 /]
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 13.54. 

[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 assign-subhandler operation with the following syntax.
 /subsystem=logging/async-handler=HANDLER:assign-subhandler(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 13.55. 

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

Example 13.56. 

[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:unassign-subhandler(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 13.57. 

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