Enable logging to monitor the usage of the DataSource connection pool in JBoss EAP
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 7
- 6
Issue
- Which logger must be used to see the usage of the datasource pool?
- Is it possible to monitor the datasource pool usage?
Resolution
Setting the logger
The logger category org.jboss.jca.core.connectionmanager.pool.strategy must be set to DEBUG or TRACE.
The following CLI command can be use in standalone mode:
/subsystem=logging/logger=org.jboss.jca.core.connectionmanager.pool.strategy:add(level=DEBUG)
If org.jboss.jca.core.connectionmanager.pool.strategy has already been defined but the log level is not set to DEBUG, use the following command to change log level:
/subsystem=logging/logger=org.jboss.jca.core.connectionmanager.pool.strategy:write-attribute(name=level,value=DEBUG)
If the server is run in domain mode the prefix for the related profile (/profile=<profile-name>) must be used. For example:
/profile=full/subsystem=logging/logger=org.jboss.jca.core.connectionmanager.pool.strategy:add(level=DEBUG)
/profile=full/subsystem=logging/logger=org.jboss.jca.core.connectionmanager.pool.strategy:write-attribute(name=level,value=DEBUG)
Note: It is necessary to restart the JVM for the change to DEBUG/TRACE to take effect.
Example messages
The following messages are logged:
DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (EJB default - 2) ExampleDS: getConnection(null, WrappedConnectionRequestInfo@4faac84[userName=sa]) [0/20]
DEBUG [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (EJB default - 2) ExampleDS: returnConnection(4d1a08fb, false) [1/19]
The numbers in [ ] show the connections <in use>/<available>;
Note TRACE is This content is not included.more verbose than DEBUG. If TRACE level is used a more detailed message will be logged instead.
Advanced monitoring
There is also spy logging which enables more detailed logging.
Connection leak detection can be explicitly activated with the CachedConnectionManager (CCM)
For versions prior to EAP 6, see Enable logging to monitor the usage of the DataSource connection pool in JBoss EAP 4.x/5.x
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.