0 Replies Latest reply on Nov 12, 2010 1:32 AM by Iván Pazmiño

    Accessing the Log4jService with MBeanProxy

    Iván Pazmiño Novice

      I'm trying to gain access to the Log4jService from a JBoss AS 5.1, which is running in my localhost,with the following code


      Log4jService log4jService = (Log4jService) MBeanProxy.get(Log4jServiceMBean.class, new ObjectName(
                  "resource:xmdesc/Log4jService-xmbean.xml"), "jboss");


      the output log shows the service is up


      INFO  [LogNotificationListener] Adding notification listener for logging mbean "jboss.system:service=Logging,type=Log4jService" to server org.jboss.mx.server.MBeanServerImpl@1588325[ defaultDomain='jboss' ]


      and the name in the conf/jboss-service.xml file is as default installed


      <mbean code="org.jboss.logging.Log4jService"




      but it fails complaining of a malformed name http://jbossas.pastebin.com/p2dfQdRV


      if the code is changed to


      log4jService = (Log4jService) MBeanProxy.get(Log4jServiceMBean.class, new ObjectName(
                  "jboss.system:type=Log4jService,service=Logging"), "jboss");


      it fails with http://jbossas.pastebin.com/X7xCkPSf


      I'm trying to get to this MBean to read the log4j configuration file and have access to the logs folder. Any ideas why can't I get this proxy?