1 2 Previous Next 15 Replies Latest reply on Mar 31, 2009 1:21 AM by vinoth kumar

    JBoss LoggingMonitor - "logger" attribute

    Fernando Matias Valadao Newbie

      Hi, guys!
      I've been analyzing JBoss LoggingMonitor for some days and I'm surprised how simple it is to configure and use :)
      By now I want to monitor two attributes ("activeSessions" and "expiredSessions") of MBeans that matches this pattern:

      "jboss.web:host=localhost,path=/MyWebContext,type=Manager"

      but I don't know how to set the attribute "logger".
      E.g.:

      activeSessions
      expiredSessions


      Unfortunately, the Logging Monitor Wiki doesn't give any clue or a better explanation about what might be the "logger" attribute.
      May you give me a hint about where can I find this information?
      Thanks in advance!

      Fernando

        • 1. Re: JBoss LoggingMonitor -
          Fernando Matias Valadao Newbie

          There was an error with the example in the original post

          <!--monitoredmbean name="jboss.web:host=localhost,path=/web-console,type=Manager" logger="???????????">
          <!--attribute>activeSessions</attribute-->
          <!--attribute>expiredSessions</attribute-->
          </monitoredmbean-->

          Thanks

          Fernando

          • 2. Re: JBoss LoggingMonitor -
            Jimmy Wilson Apprentice

             

            "ramone1234" wrote:
            Unfortunately, the Logging Monitor Wiki doesn't give any clue or a better explanation about what might be the "logger" attribute. May you give me a hint about where can I find this information?


            The logger attribute is the name of the Log4j logger that you wish to use. Strictly speaking, in a programming sense, the line of code where that attribute is used is:

            Logger logger = Logger.getLogger(<logger attribute goes here>);


            This allows you to take advantage of Log4j logging inheritance/configuration, but that is really beyond the scope of this post.

            The simplest answer would be that any arbitrary (but meaningful) logger name should do just fine.

            For more information on Log4j and its use, see the Log4j website: http://logging.apache.org/log4j/.

            • 3. Re: JBoss LoggingMonitor -
              Fernando Matias Valadao Newbie

              Hello, James!
              Thank you very much for your reply!
              It worked just fine and now I am able to monitor my app http sessions :0)
              but I have a tricky question: when JBoss is starting, I get the following error message:

              09:51:33,908 ERROR [LoggingMonitorTimerTask] Unable to log MBean attributes: javax.management.InstanceNotFoundException: jboss.web:host=localhost,path=/web-console,type=Manager is not registered.
              at org.jboss.mx.server.registry.BasicMBeanRegistry.get(BasicMBeanRegistry.java:454)
              at org.jboss.mx.server.MBeanServerImpl.getAttribute(MBeanServerImpl.java:433)
              at org.jboss.monitor.MonitoredMBean.logAttributes(MonitoredMBean.java:105)
              at org.jboss.monitor.LoggingMonitorTimerTask.run(LoggingMonitorTimerTask.java:51)
              at java.util.TimerThread.mainLoop(Timer.java:512)
              at java.util.TimerThread.run(Timer.java:462)

              Althought I get it during the startup of JBoss, the logging monitor is working perfectly. Do you have any idea why this is happening?
              Thanks!

              Fernando

              • 4. Re: JBoss LoggingMonitor -
                Jimmy Wilson Apprentice

                 

                "ramone1234" wrote:
                Do you have any idea why this is happening?

                The short answer is that the logging monitor service is being deployed before JBossWeb (Tomcat), so the MBean you wish to monitor is not yet available. The errors you see go away (and everything works like you wish) once the MBean you are monitoring becomes available.

                For many uses of logging monitor, you can resolve this issue by using the MBean depends tag in the logging monitor XML descriptor to cause the deployment of logging monitor to depend on the deployment of the MBean you are monitoring. See the provided example for monitoring the default datasource on the wiki page for an illustration on how to do this ( http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossLoggingMonitorExampleDefaultDSServiceConfig ).

                In your case, however, the MBean that you are using can not be depended on in this manner. See http://wiki.jboss.org/wiki/Wiki.jsp?page=MyDependencyDoesntWork for more information.

                By adding the dependency specified below to your logging monitor deployment descriptor, you can make the logging monitor deployment depend upon the deployment of the web server service, and that causes the logging monitor deployment to wait until the web server service (and the MBean you wish to monitor) becomes available.

                <depends>jboss.web:service=WebServer</depends>


                • 5. Re: JBoss LoggingMonitor -
                  Fernando Matias Valadao Newbie

                  For all of you who may face the same problem as we did, here comes the solution that we came up with.

                  If you want to monitor an MBean which follows the pattern

                  jboss.web:host=localhost,path=/myWebContext,type=Manager

                  then it must depend on another mbean which follows the pattern:

                  jboss.web.deployment:war=myWebContext.war,id=-703441128

                  The tricky part is that this "id" attribute is not the same regarding different servers!!! Therefore, you must first check this id before deploying the logging mbean service.

                  Regards,

                  Fernando

                  • 6. Re: JBoss LoggingMonitor -
                    krishnaroopa Senthilkumar Newbie

                    Hi all

                    I have a webservice hosted and can view the details of MBean in JMX-console.

                    Under jboss.ws


                    context=SampleWebService,endpoint=SampleWebService


                    The attributes listed includes request, response counts
                    So, I tried to use loggingmonitor to get these values.

                    my xml file in deploy directory has
                     <attribute name="MonitoredObjects">
                     <configuration>
                     <monitoredmbean name="jboss.ws.SampleWebService"
                     logger="SampleLogger">
                     <attribute>RequestCount</attribute>
                     <attribute>ResponseCount</attribute>
                     <attribute>FaultCount</attribute>
                     </monitoredmbean>
                     </configuration>
                     </attribute>
                    


                    But I get error in server log as


                    --- Incompletely deployed packages ---
                    org.jboss.deployment.DeploymentInfo@4b9e0dcf { url=file:/root/mobicents-all-1.2.0.CR3-jboss-4.2.3.GA-0812022325/jboss-4.2.3.GA/server/default/deploy/SampleWebService-monitor.xml }
                    deployer: null
                    status: null
                    state: INIT_WAITING_DEPLOYER
                    watch: file:/root/mobicents-all-1.2.0.CR3-jboss-4.2.3.GA-0812022325/jboss-4.2.3.GA/server/default/deploy/SampleWebService-monitor.xml
                    altDD: null
                    lastDeployed: 1237442698503
                    lastModified: 1237442698000
                    mbeans:


                    Pl. help out?

                    regards
                    KRS

                    • 7. Re: JBoss LoggingMonitor -
                      Dimitris Andreadis Master

                      You must rename your descriptor:

                      SampleWebServiceMonitor-service.xml

                      • 8. Re: JBoss LoggingMonitor -
                        vinoth kumar Newbie

                        Hi All,

                        I have a webservice hosted on my machine and I had deployed the xml file(Deployment Descriptor File) for logging monitor with the name XXXXXX-monitor-service.xml

                        The attributes defined are :

                         <attribute name="MonitoredObjects">
                         <configuration>
                         <monitoredmbean name="jboss.ws.XXXXXX"
                         logger="com.sample">
                         <attribute>RequestCount</attribute>
                         <attribute>ResponseCount</attribute>
                         <attribute>FaultCount</attribute>
                         </monitoredmbean>
                         </configuration>
                         </attribute>
                        
                         <depends>jboss.ws.XXXXXX</depends>
                         </mbean>


                        I got the following exception :

                        Problem configuring service jboss.monitor:type=LoggingMonitor,name=XXXMonitor
                        org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@1eacdc4 on mbean jboss.monitor:type=LoggingMonitor,name=XXXMonitor; - nested throwable: (javax.management.MalformedObjectNameException: Key properties cannot be empty)
                        at org.jboss.system.ServiceConfigurator.setAttribute(ServiceConfigurator.java:707)
                        at org.jboss.system.ServiceConfigurator.configure(ServiceConfigurator.java:332)


                        and
                        --- MBeans waiting for other MBeans ---
                        ObjectName: jboss.monitor:type=LoggingMonitor,name=XXXMonitor
                        State: FAILED
                        Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@1eacdc4 on mbean jboss.monitor:type=LoggingMonitor,name=XXXMonitor; - nested throwable: (javax.management.MalformedObjectNameException: Key properties cannot be empty)

                        --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
                        ObjectName: jboss.monitor:type=LoggingMonitor,name=XXXMonitor
                        State: FAILED
                        Reason: org.jboss.deployment.DeploymentException: Exception setting attribute javax.management.Attribute@1eacdc4 on mbean jboss.monitor:type=LoggingMonitor,name=XXXMonitor; - nested throwable: (javax.management.MalformedObjectNameException: Key properties cannot be empty)



                        Pls help me to tackle the issue.


                        Regards,
                        Vinoth Kumar.


                        • 9. Re: JBoss LoggingMonitor -
                          Dimitris Andreadis Master

                          Post the whole -service.xml descriptor.

                          • 10. Re: JBoss LoggingMonitor -
                            vinoth kumar Newbie

                            Hi Dimitris,

                            Thanks for your reply. Here is the descriptor.


                            <?xml version="1.0" encoding="UTF-8"?>
                            <!DOCTYPE server PUBLIC
                            "-//JBoss//DTD MBean Service 4.0//EN"
                            "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">

                            <server>

                            <mbean code="org.jboss.services.loggingmonitor.LoggingMonitor"
                            name="jboss.monitor:type=LoggingMonitor,name=SampleWSMonitor">


                            <attribute name="Filename">${jboss.server.log.dir}/SampleWS.log</attribute>
                            <attribute name="AppendToFile">false</attribute>
                            <attribute name="RolloverPeriod">DAY</attribute>
                            <attribute name="MonitorPeriod">5000</attribute>

                            <attribute name="MonitoredObjects">
                            <configuration>
                            <monitoredmbean name="jboss.ws.SampleWS"
                            logger="com.sample">
                            <attribute>RequestCount</attribute>
                            <attribute>ResponseCount</attribute>
                            <attribute>FaultCount</attribute>
                            </monitoredmbean>
                            </configuration>
                            </attribute>

                            <depends>jboss.ws.SampleWS</depends>
                            </mbean>

                            </server>





                            Thanks,
                            Vinoth Kumar.

                            • 11. Re: JBoss LoggingMonitor -
                              vinoth kumar Newbie

                              Hi Dimitris,

                              Thanks for your reply. Here is the descriptor.


                              <?xml version="1.0" encoding="UTF-8"?>
                              <!DOCTYPE server PUBLIC
                               "-//JBoss//DTD MBean Service 4.0//EN"
                               "http://www.jboss.org/j2ee/dtd/jboss-service_4_0.dtd">
                              
                              <server>
                              
                               <mbean code="org.jboss.services.loggingmonitor.LoggingMonitor"
                               name="jboss.monitor:type=LoggingMonitor,name=SampleWSMonitor">
                              
                              
                               <attribute name="Filename">${jboss.server.log.dir}/SampleWS.log</attribute>
                               <attribute name="AppendToFile">false</attribute>
                               <attribute name="RolloverPeriod">DAY</attribute>
                               <attribute name="MonitorPeriod">5000</attribute>
                              
                               <attribute name="MonitoredObjects">
                               <configuration>
                               <monitoredmbean name="jboss.ws.SampleWS"
                               logger="com.sample">
                               <attribute>RequestCount</attribute>
                               <attribute>ResponseCount</attribute>
                               <attribute>FaultCount</attribute>
                               </monitoredmbean>
                               </configuration>
                               </attribute>
                              
                               <depends>jboss.ws.SampleWS</depends>
                               </mbean>
                              
                              </server>
                              




                              Thanks,
                              Vinoth Kumar.

                              • 13. Re: JBoss LoggingMonitor -
                                vinoth kumar Newbie

                                Hi Dimitris,

                                Thanks for your reply. I am having a webservice deployed in my Jboss Server.(jboss-4.2.3.GA). I am trying to use the logging monitor to get the values such as Request Count, Response Count,etc. I would like to know how to configure the descriptor file and any other changes required to monitor the webservice. Any suggestions/links will be helpful.



                                Thanks and Regards,
                                Vinoth Kumar.

                                • 14. Re: JBoss LoggingMonitor -
                                  Dimitris Andreadis Master

                                  There is no magic here. You need to specify in the 'depends' and 'monitoredmbean name=" clauses the ObjectName of the mbean you want to monitor.

                                  If you don't know the full mbean name you want to monitor, you need to find it. Logging to the jmx-console and look for it.

                                  1 2 Previous Next