There is a JMX problem in LOG4J 1.2.8, the class org.apache.log4j.Level is not serializable. In a simple JMX request I got an unserializable exception. Here is a code snippet of an example code. Content of getContent method: import weblogic.management.RemoteMBeanServer; import javax.management.Attribute; import javax.management.MBeanAttributeInfo; import javax.management.MBeanInfo; import javax.management.ObjectName; [...] private MBeanAttributeInfo attrInfo = null; private RemoteMBeanServer homeServer = null; [...] try { value = homeServer.getAttribute(new ObjectName(domain + ":" + mbeanName), attrInfo.getName()); } catch (Exception e) { e.printStackTrace(); } where homeServer is a reference to a RemoteMBeanServer instance by Weblogic, domain is "log4j", mbeanName is "appender=MUSYK1" (defined in log4j.properties file) and attrInfo.getName() is "encoding". weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception: [java.rmi.MarshalException: error marshalling return; nested exception is: java.io.NotSerializableException: org.apache.log4j.Level] at weblogic.management.internal.RemoteMBeanServerImpl_812_WLStub.getAttribute (Unknown Source) at tui.musyk.weblogic.jmx.gui.model.MBeanAttributeProxy.getContent (MBeanAttributeProxy.java:61) [...]
I have kind of the same problem. This is not a hard fix and would not break anything. Can somebody confirm if this goes into the next version.
It should be easy to make the Level class implement Serializable. Please ask on the log4j-dev list to make sure none of the committers object.
1.2.12 candidate
Committed on log4j CVS HEAD and 1.2 branch. Versions appears to be binary compatible. Adding LoggingEvent serialization tests, but they are not currently binary compatible.
*** Bug 34758 has been marked as a duplicate of this bug. ***