Summary: | HierarchyDynamicMBean missing unregister MBean | ||
---|---|---|---|
Product: | Log4j - Now in Jira | Reporter: | wing tung Leung <wingtung.leung> |
Component: | Other | Assignee: | log4j-dev <log4j-dev> |
Status: | RESOLVED FIXED | ||
Severity: | enhancement | ||
Priority: | P2 | ||
Version: | 1.2 | ||
Target Milestone: | --- | ||
Hardware: | Other | ||
OS: | other | ||
Attachments: |
Patch JMX MBean classes to perform automatic cleanup
log4j 1.2 version of the mbean deregister patch |
Description
wing tung Leung
2006-08-14 09:59:25 UTC
Created attachment 18715 [details]
Patch JMX MBean classes to perform automatic cleanup
This patch solves my problem and unregisters all MBean instances during
undeployment. My previously described workaround is not working because some
MBean instances are added automatically without needing the explicit
addLoggerMBean() call.
Please review for inclusion.
1.2.15 consideration Although this patch is targetted for trunk, it would need slight rework for inclusion in the 1.2 tree, because it uses JDK 1.2+ Collections framework plus the use of the getLogger() calls. If we consider this for the 1.2 tree, then it'll need to port that to standard java.util.Vector class, and use LogLog instead. If the original author was able to, a patch against the 1.2 tree would be well received, otherwise I might take a stab at it later. Reassigning this one back to log4j-dev list, it was my mistake to completely reassign this issue, it prevents the comments from being seen on the mailing list. Created attachment 20072 [details]
log4j 1.2 version of the mbean deregister patch
I modified the original patch (which I had to apply by hand, wasn't quite a
unified diff format) to make it log4j 1.2 compatible.
I've had difficulty testing this however, because I can't seem to get the
preDeregister method to fire at all. I can't work out exactly what the correct
way to 'shutdown' the JMX agent in my test harness app I have local.
If someone else knew what to do to verify behaviour, could they take the patch
and try it out?
Help needed to verify the functionality of the code. I'd actually like to see this one done for 1.2.16 personally. Fixed in revision 686131. Tested by creating a local test harness class that instantiates an MBeanServer, and registers the Hierarchy Mbean and then unregister it. The Loggers and Appenders appear to register and unregister successfully. Thanks for the patch, it's only been 2 years and 1 day in applying! |