On 2006-08-08, at 20.41, Marko Asplund wrote:
I'm trying to figure out how to setup a Java SE 5 application so
that jconsole can be used for modifying log levels at run time.
I'd appreciate any pointers or hints on how to do this.
The following lines of code seem to do the job:
MBeanServer server = ManagementFactory.getPlatformMBeanServer();
HierarchyDynamicMBean h = new HierarchyDynamicMBean();
server.registerMBean(h, new ObjectName("log4j:hierarchy=default"));
h.addLoggerMBean("fi.kvanttisofta");
I can monitor the appenders as well as the root and the explicitly
added logger through JConsole. I'm also able to modify appender
config but also change log levels at run time. Other loggers can be
manually added with JConsole as needed.
Is the JMX support in log4j v1.2.13 considered production quality?
Are there any caveats I should be aware of?
--
aspa
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]