try
{
objectName = new ObjectName("log4j", "appender", name);
// register appender as mbean if not already existing
if (!getMBeanServer().isRegistered(objectName)) {
AppenderDynamicMBean appenderMBean = new AppenderDynamicMBean(appender);
getMBeanServer().registerMBean(appenderMBean, objectName);
_attributes
.add(new MBeanAttributeInfo("appender=" + name, "javax.management.ObjectName",
"The " + name + " appender.", true, true, false));