Change log level at runtime in JBoss EAP/Wildfly with CLI

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

This post demonstrates you how you can set the defined log levels of log categories (e.g. classname) and of the root logger in the standalone.xml. Same applies to the domain mode. Just add the profile name before the cli command. It was very useful, to correct the verbose output of a running application in production.

In case you didn’t setup your java environment properly, a quick setup on the terminal:

tan@cinhtau:~> export JAVA_HOME=/opt/java/jdk1.8.0_66
tan@cinhtau:~> export PATH=$PATH:$JAVA_HOME/bin

Start JBoss cli, replace hostname/IP and port according to your configuration

tan@cinhtau:~> /opt/jboss/jboss-eap-6.4.4/bin/jboss-cli.sh --controller= --connect

Change log level of root logger, outcome is success, if applied successfully

[standalone@ /] /subsystem=logging/root-logger=ROOT:write-attribute(name="level", value="INFO")
{"outcome" => "success"}

If you are using a logging profile, add the logging profile in between.

/subsystem=logging/logging-profile=DEMO/root-logger=ROOT:write-attribute(name="level", value="INFO")

Change log level of log category, outcome is success, if applied successfully

[standalone@ /] /subsystem=logging/logger=net.cinhtau.dmr:write-attribute(name="level", value="INFO")
{"outcome" => "success"}

Leave the CLI

[standalone@ /] exit
Please remember the terms for blog comments.