Loading...

Remove Logger in JBoss EAP 6.x, Wildfly configuration

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

For local testing, the logging is an essential tool. If you have to make changes to loggers, some conflicts arise. The easiest way is to remove the previous configuration. If you want to cleanup your previous logging, this article demonstrates the basic steps for a CLI script, that can be used for each test.

This example removes a logger ( name ≡ CATEGORY) and the respective log handler.

# =====================================
#       _
#   ___| | ___  __ _ _ __  _   _ _ __
#  / __| |/ _ \/ _` | '_ \| | | | '_ \
# | (__| |  __/ (_| | | | | |_| | |_) |
#  \___|_|\___|\__,_|_| |_|\__,_| .__/
#                               |_|
# =====================================
# /subsystem=logging/logger=CATEGORY:read-resource
# /subsystem=logging/logger=CATEGORY:unassign-handler(name="HANDLER")
# /subsystem=logging/logger=CATEGORY:remove
# =====================================
# HTTP pool logger
if (outcome == success) of /subsystem=logging/logger=metrics-http-stat:read-resource
    /subsystem=logging/logger=metrics-http-stat:unassign-handler(name="METRICS")
    /subsystem=logging/logger=metrics-http-stat:remove
end-if
# ===================
# remove file handler
# ===================
if (outcome == success) of /subsystem=logging/periodic-rotating-file-handler=METRICS:read-resource
    /subsystem=logging/periodic-rotating-file-handler=METRICS:remove
end-if
  • The logger is checked, if true, we can remove it.
  • Before removal it has to be unassigned.
  • Remove the logger.
  • The final step is to remove the file handler.

With read-resource you can always check if the resource exists. If you are unsure if can invoke read-resource-description. This command will list description of available attributes and childs.

C:\jboss-eap-6.4\bin\jboss-cli.bat --connect --command="/subsystem=logging/periodic-rotating-file-handler=METRICS:read-resource-description" > output.txt

See also

Please remember the terms for blog comments.