JBoss show JDBC Queries

Sometimes it is necessary to see which queries are executed and what the parameters of these queries have been. To get this data from a JBoss 7+ you have to follow these steps:

Enable JDBC-Spy on Datasource:


Or just add spy=”true” as attribute in standalone.xml.

Then you have to enable the spy by adding a loglevel:


If this doesn’t output anything your loglevel is above trace. Default is INFO. So nothing is displayed.

Add the following part to your logging configuration to enable TRACE-logging for a single package:

<subsystem xmlns="urn:jboss:domain:logging:2.0">
<console-handler name="TRACER">
  <level name="TRACE"/>
    <named-formatter name="COLOR-PATTERN"/>
<logger category="jboss.jdbc.spy" use-parent-handlers="false">
  <level name="TRACE"/>
    <handler name="TRACER"/>

I didn’t use command line for this but of course it would be possible to do so.

Leave a Comment