Enable logging to monitor the usage of the DataSource connection pool in JBoss EAP 4.x/5.x

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 4.x
    • 5.x

Issue

  • How to change a log setting to show the evolution of the DataSource pool on JBoss EAP 4.x/5.x?
  • How to monitor the usage of the DataSource pool on JBoss EAP 4.x/5.x?
  • How to recognize a connection object obtained from DataSource pool in logging?

Resolution

  • Uncomment the following log setting which is commented out in $JBOSS_HOME/server/$PROFILE/conf/jboss-log4j.xml:

      <!-- Show the evolution of the DataSource pool in the logs [inUse/Available/Max]
      <category name="org.jboss.resource.connectionmanager.JBossManagedConnectionPool">
        <priority value="TRACE"/>
      </category>
      -->
    

    Then you can monitor the usage of the DataSource connection pool by log messages like "[InUse/Available/Max]: [1/19/20]" from the server.log.

  • You can recognize a connection object which is obtained from DataSource connection pool by using grep with "Got connection from pool" from server.log:

TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Got connection from pool tracked by transaction org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1610944[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@fa43e8 handles=0 lastUse=1269349580406 permit=true trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$PoolBySubject@805298 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ae7b77 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@12bc407 txSync=null] tx=TransactionImple < ac, BasicAction: 7f000001:cb56:4ba8bcc2:88 status: ActionStatus.RUNNING > [InUse/Available/Max]: [1/19/20]
  • And also, you can recognize a connection object which is returned to DataSource connection pool by using grep with "Returning connection to pool" from server.log:
TRACE [org.jboss.resource.connectionmanager.JBossManagedConnectionPool] Returning connection to pool org.jboss.resource.connectionmanager.TxConnectionManager$TxConnectionEventListener@1610944[state=NORMAL mc=org.jboss.resource.adapter.jdbc.local.LocalManagedConnection@fa43e8 handles=0 lastUse=1269349580409 permit=false trackByTx=false mcp=org.jboss.resource.connectionmanager.JBossManagedConnectionPool$PoolBySubject@805298 context=org.jboss.resource.connectionmanager.InternalManagedConnectionPool@ae7b77 xaResource=org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource@12bc407 txSync=null] [InUse/Available/Max]: [0/20/20]
Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.