2 Replies Latest reply on Dec 1, 2017 11:09 AM by nitharose

    How to Enable SQL Trace in jboss-5.1.0.GA

    nitharose

      Can some one please help me to enable SQL tracing/JDBC Tracing in jboss-5.1.0.GA servers.

      I Basically want to get the all the sql statements(select,update,delete, insert etc) used/generated during the loading of a web application(oracle DB) hosted in jboss.

      I tried p6spy.jar option as mentioned in link How to trace JDBC statements with JBoss and WildFly . But i didn't get any result. Any help in this topic will be greatly appreciated

        • 1. Re: How to Enable SQL Trace in jboss-5.1.0.GA
          andey

          There are two steps to enabling logging of the JBossManagedConnectionPool.

           

          1#Uncomment or add the following entry in <JBOSS HOME>/server/<profile>/conf/jboss-log4j.xml

           

          ~~~

             <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">

               <priority value="TRACE"/>

             </category>

          ~~~

           

          2#The EAP instance must read the new value via one of the following:

           

          - restart of the server instance

          - allow the amount of time specified by the RefreshPeriod in conf/xmdesc/Log4jService-xmbean.xml to elapse before the change is noted by the EAP instance.

          - change the setting via the Log4jService

           

          ~~~

          http://<HOST>:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.system%3Atype%3DLog4jService%2Cservice%3DLogging

          ~~~

           

          Note that custom configurations of appenders in <JBOSS HOME>/server/<profile>/conf/jboss-log4j.xml can modify where the expected output occurs. Occasionally this will need to be checked if TRACE logging is not seen when expected.

          • 2. Re: How to Enable SQL Trace in jboss-5.1.0.GA
            nitharose

            Hi Anup - Thanks for the details.

             

            1. 1. I have uncommented JBossManagedConnectionPool in jboss-log4j.xml
            2. 2. I have restarted the server

             

            Am unable to view the SQL statements logged in the server.log file. Am attaching the screenshot of the URL below. Could you please help and let me know if i need to do anything else.

             

            http://localhost:8080/jmx-console/HtmlAdaptor?action=inspectMBean&name=jboss.system%3Atype%3DLog4jService%2Cservice%3DLogging

             

            Thanking you again for the reply. It is appreciated.