Show Table of Contents
14.3.7. 在 CLI 里配置 Async 日志处理程序
您可以在 CLI 里添加、删除和编辑异步(Async)日志处理程序。
配置异步日志处理程序的主要任务是:
- 添加新的 Async 日志处理程序。
- 显示异步日志处理程序的配置
- 改变日志级别
- 设置队列长度
- 设置溢出动作
- 添加子处理程序
- 删除子处理程序
- 删除异步日志处理程序
每个任务都将在下面进行描述。
重要
当在日志配置集里配置日志处理程序时,配置路径的根目录是
/subsystem=logging/logging-profile=NAME/ 而不是/subsystem=logging/。
- 添加新的 Async 日志处理程序。
- 使用
add操作和下列语法。/subsystem=logging/async-handler=HANDLER:add(queue-length="LENGTH")
用文件日志处理程序的名称替换 HANDLER,并用保持在队列里的日志请求的最大数目替换 LENGTH。例 14.51.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:add(queue-length="10") {"outcome" => "success"} - 显示异步日志处理程序的配置
- 使用
read-resource操作和下列语法。/subsystem=logging/async-handler=HANDLER:read-resource
用文件日志处理程序的名称替换 HANDLER。例 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 /] - 改变日志级别
- 请使用
write-attribute命令和下列语法。/subsystem=logging/async-handler=HANDLER:write-attribute(name="level", value="LOG_LEVEL_VALUE")
用日志处理程序的名称替换 HANDLER,并用日志级别替换 LOG_LEVEL_VALUE。例 14.53.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:write-attribute(name="level", value="INFO") {"outcome" => "success"} [standalone@localhost:9999 /] - 设置队列长度
- 请使用
write-attribute命令和下列语法。/subsystem=logging/async-handler=HANDLER:write-attribute(name="queue-length", value="LENGTH")
用文件日志处理程序的名称替换 HANDLER,并用保持在队列里的日志请求的最大数目替换 LENGTH。重启 JBoss EAP 6 服务器以使修改生效。例 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" } } - 设置溢出动作
- 请使用
write-attribute命令和下列语法。/subsystem=logging/async-handler=HANDLER:write-attribute(name="overflow-action", value="ACTION")
用文件日志处理程序的名称替换 HANDLER,并用 DISCARD 或 BLOCK 替换 ACTION。例 14.55.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:write-attribute(name="overflow-action", value="DISCARD") {"outcome" => "success"} [standalone@localhost:9999 /] - 添加子处理程序
- 使用
add-handler操作和下列语法。/subsystem=logging/async-handler=HANDLER:add-handler(name="SUBHANDLER")
用文件日志处理程序的名称替换 HANDLER,并用将被添加为子处理程序的日志处理程序的名称替换 SUBHANDLER。例 14.56.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:add-handler(name="NFS_FILE") {"outcome" => "success"} [standalone@localhost:9999 /] - 删除子处理程序
- 使用
remove-handler操作和下列语法。/subsystem=logging/async-handler=HANDLER:remove-handler(name="SUBHANDLER")
用文件日志处理程序的名称替换 HANDLER,并用要删除的子处理程序的名称替换 SUBHANDLER。例 14.57.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:remove-handler(name="NFS_FILE") {"outcome" => "success"} [standalone@localhost:9999 /] - 删除异步日志处理程序
- 使用
remove操作和下列语法。/subsystem=logging/async-handler=HANDLER:remove
用文件日志处理程序的名称替换 HANDLER。例 14.58.
[standalone@localhost:9999 /] /subsystem=logging/async-handler=NFS_LOGS:remove {"outcome" => "success"} [standalone@localhost:9999 /]

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.