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:

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

Leave a Reply