You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2010/07/14 13:31:27 UTC
DO NOT REPLY [Bug 49592] New: 477 All Attributes Not Set
https://issues.apache.org/bugzilla/show_bug.cgi?id=49592
Summary: 477 All Attributes Not Set
Product: Log4j
Version: 1.2
Platform: PC
OS/Version: Windows XP
Status: NEW
Severity: critical
Priority: P2
Component: Appender
AssignedTo: log4j-dev@logging.apache.org
ReportedBy: x_tadoor@ugs.com
We are using the HierarchyDynamicMBean Mbean to get all the log4j mbeans
registered.
We have a in built Monitoring, Logging and Debugging tool Mbean and we using
HierarchyDynamicMBean to register it to the PlatformMBeanServer and the HTML
Adaptor so that the MLD MBean appears in the log4j hiearchy.
When we are setting the "priority" of this logger it sets the priority but
prints the following message
477 All Attributes Not Set
--------------------------------------------------------------------------------
2/3 attribute(s) were not set:
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Step one:
From the eclipse launch the application code from the Source code for an
executable test case section below.
Step two:
from the internet explorer launch http://localhost:9393
Step Three:
In the log4J section of the page
Select "logger=root" MBean , in its attribute page change the priority from
DEBUG to WARN and click on apply button below and we get the following message
as
477 All Attributes Not Set
ACTUAL -
477 All Attributes Not Set
ERROR MESSAGES/STACK TRACES THAT OCCUR :
javax.management.AttributeNotFoundException: Attribute
appender%3Dorg.apache.log4j.FileAppender@1c9a690 not found in
org.apache.log4j.jmx.LoggerDynamicMBean
at
org.apache.log4j.jmx.LoggerDynamicMBean.setAttribute(LoggerDynamicMBean.java:242)
at
org.apache.log4j.jmx.AbstractDynamicMBean.setAttributes(AbstractDynamicMBean.java:118)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.setAttributes(DefaultMBeanServerInterceptor.java:819)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.setAttributes(JmxMBeanServer.java:728)
at com.sun.jdmk.comm.HtmlObjectPage.setObjectValue(HtmlObjectPage.java:426)
at
com.sun.jdmk.comm.HtmlRequestHandler.processGetRequest(HtmlRequestHandler.java:301)
at
com.sun.jdmk.comm.HtmlRequestHandler.processRequest(HtmlRequestHandler.java:155)
at com.sun.jdmk.comm.HtmlRequestHandler.doRun(HtmlRequestHandler.java:82)
at com.sun.jdmk.comm.ClientHandler.run(ClientHandler.java:99)
at java.lang.Thread.run(Thread.java:619)
javax.management.AttributeNotFoundException: Attribute
appender%3Dorg.apache.log4j.FileAppender@1c9a690 not found in
org.apache.log4j.jmx.LoggerDynamicMBean
at
org.apache.log4j.jmx.LoggerDynamicMBean.setAttribute(LoggerDynamicMBean.java:242)
at
org.apache.log4j.jmx.AbstractDynamicMBean.setAttributes(AbstractDynamicMBean.java:118)
at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.setAttributes(DefaultMBeanServerInterceptor.java:819)
at
com.sun.jmx.mbeanserver.JmxMBeanServer.setAttributes(JmxMBeanServer.java:728)
at com.sun.jdmk.comm.HtmlObjectPage.setObjectValue(HtmlObjectPage.java:426)
at
com.sun.jdmk.comm.HtmlRequestHandler.processGetRequest(HtmlRequestHandler.java:301)
at
com.sun.jdmk.comm.HtmlRequestHandler.processRequest(HtmlRequestHandler.java:155)
at com.sun.jdmk.comm.HtmlRequestHandler.doRun(HtmlRequestHandler.java:82)
at com.sun.jdmk.comm.ClientHandler.run(ClientHandler.java:99)
at java.lang.Thread.run(Thread.java:619)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
This is the example source code that we have done outside our dev environment
the following is the source code
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.util.Vector;
import javax.management.InstanceAlreadyExistsException;
import javax.management.JMException;
import javax.management.MBeanAttributeInfo;
import javax.management.MBeanRegistrationException;
import javax.management.MBeanServer;
import javax.management.MalformedObjectNameException;
import javax.management.NotCompliantMBeanException;
import javax.management.ObjectName;
import org.apache.log4j.Appender;
import org.apache.log4j.FileAppender;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.apache.log4j.SimpleLayout;
import org.apache.log4j.jmx.*;
import com.sun.jdmk.comm.HtmlAdaptorServer;
//import org.apache.log4j.BasicConfigurator;
public class MyTestApp {
private Vector dAttributes = new Vector();
private static Logger logger = Logger.getRootLogger();
static MBeanServer server = ManagementFactory.getPlatformMBeanServer();
private static Logger cat = Logger.getLogger(MyTestApp.class);
// public MyTestApp(Logger logger)
// {
// super(logger);
//
// }
public void go() throws Exception{
while(true){
logger.debug("DEBUG") ;
logger.info("INFO") ;
logger.warn("WARN");
logger.error("ERROR");
logger.fatal("FATAL");
Thread.sleep(2000);
}
}
// void registerAppenderMBean1(Appender appender) {
// String name = getAppenderName(appender);
// cat.debug("Adding AppenderMBean for appender named "+name);
// ObjectName objectName = null;
// try {
// AppenderDynamicMBean appenderMBean = new
AppenderDynamicMBean(appender);
// objectName = new ObjectName("log4j", "appender", name);
// if (!server.isRegistered(objectName)) {
// server.registerMBean(appenderMBean, objectName);
// dAttributes.add(new MBeanAttributeInfo("appender=" + name,
"javax.management.ObjectName",
// "The " + name + " appender.", true, true, false));
// }
//
// } catch(JMException e) {
// cat.error("Could not add appenderMBean for ["+name+"].", e);
// } catch(java.beans.IntrospectionException e) {
// cat.error("Could not add appenderMBean for ["+name+"].", e);
// } catch(RuntimeException e) {
// cat.error("Could not add appenderMBean for ["+name+"].", e);
// }
// }
public static void main(String[] args) {
//BasicConfigurator.configure();
org.apache.log4j.Layout layout = new SimpleLayout();
FileAppender appender = null;
try {
appender = new FileAppender(layout, "app.log");
} catch (IOException e1) {
e1.printStackTrace();
}
Logger logger = Logger.getRootLogger();
logger.addAppender(appender);
MyTestApp app = new MyTestApp();
HierarchyDynamicMBean hdm = new HierarchyDynamicMBean();
try {
ObjectName mbo = new ObjectName("log4j:hiearchy=root");
try {
server.registerMBean(hdm, mbo);
} catch (InstanceAlreadyExistsException e) {
e.printStackTrace();
} catch (MBeanRegistrationException e) {
e.printStackTrace();
} catch (NotCompliantMBeanException e) {
e.printStackTrace();
}
} catch (MalformedObjectNameException e1) {
e1.printStackTrace();
} catch (NullPointerException e1) {
e1.printStackTrace();
}
// app.registerAppenderMBean1(appender);
int portNumber=9393;
//ObjectName htmlName = new ObjectName("log4j:hiearchy=default,port=" +
portNumber) ;
ObjectName htmlName = null;
try {
htmlName = new ObjectName("log4j:logger=root,port=" + portNumber);
} catch (MalformedObjectNameException e1) {
e1.printStackTrace();
} catch (NullPointerException e1) {
e1.printStackTrace();
}
//ObjectName htmlName = new ObjectName("jmxexample:type=MyApp,port="
+ portNumber) ;
HtmlAdaptorServer html = new HtmlAdaptorServer(portNumber);
html.setPort(portNumber);
try {
server.registerMBean(html, htmlName);
} catch (InstanceAlreadyExistsException e1) {
e1.printStackTrace();
} catch (MBeanRegistrationException e1) {
e1.printStackTrace();
} catch (NotCompliantMBeanException e1) {
e1.printStackTrace();
}
html.start();
try {
app.go();
} catch (Exception e) {
e.printStackTrace();
}
}
}
---------- END SOURCE ----------
Thanks
Vilas
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 49592] 477 All Attributes Not Set
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49592
Vilas <x_...@ugs.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |ErrorMessage
--- Comment #1 from Vilas <x_...@ugs.com> 2010-07-14 07:38:12 EDT ---
We are using log4j to implement dynamic logging in our application.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 49592] 477 All Attributes Not Set
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49592
--- Comment #2 from Vilas <x_...@ugs.com> 2010-07-15 02:37:59 EDT ---
Any advice on the same.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
DO NOT REPLY [Bug 49592] 477 All Attributes Not Set
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49592
Vilas <x_...@ugs.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |x_tadoor@ugs.com
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org