I have a logging.properties where handlers are java.util.logging.FileHandler,java.util.logging.ConsoleHandler.
default logging level for root logger is set to INFO.
The logging file is passed to JVM_OPTS at startup.
How can I override the level to say "FINEST" or "DEBUG" at runtime without restart of server using java.util.logging?
You want to use ManagementFactory.getPlatformMXBean(PlatformLoggingMXBean.class) to access the operations. The easy way to do that is to use a tool that supports MBean access.
Connecting JConsole to Undertow (locally or remotely) and use the MBean tab to change the logger level is the ideal way. One issue is that the logger names don't exist unless the code has triggered the creation of a logger. You can't use the MBean to create a logger ahead of the code running. If you are using JConsole locally make sure it is running under the same account as Undertow.
java.util.logging->Logging->Operations
setLoggerLevel
.p0
. If it is the root logger then input is blank.p1
. In this case it would beFINEST
.setLoggerLevel
. If the operation works you will seeMethod successfully invoked
.Similar steps can be performed with JMXTerm.