The P6Spy tool is integrated into JOnAS and it provides an easy way to trace the SQL requests sent to the database.
To enable this tracing feature, perform the following configuration steps:
Update the appropriate RAR file's jonas-ra.xml file by setting the dsClass property to com.p6spy.engine.spy.P6SpyDriver.
Set the realdriver property in the spy.properties file (located in $JONAS_BASE/conf) to the JDBC driver of your actual database.
Verify that logger.org.objectweb.jonas.jdbc.sql.level is set to DEBUG in $JONAS_BASE/conf/trace.properties.
Example:
jonas-ra.xml file content:
<jonas-resource> <jndiname>jdbc_3</jndiname> <rarlink>JOnASJDBC_DM</rarlink> <native-lib></native-lib> <log-enabled>true</log-enabled> <log-topic>org.objectweb.jonas.jdbc.DMPostgres</log-topic> <pool-params> <pool-init>0</pool-init> <pool-min>0</pool-min> <pool-max>100</pool-max> <pool-max-age>0</pool-max-age> <pstmt-max>10</pstmt-max> </pool-params> <jdbc-conn-params> <jdbc-check-level>0</jdbc-check-level> <jdbc-test-statement></jdbc-test-statement> </jdbc-conn-params> <jonas-config-property> <jonas-config-property-name>user</jonas-config-property-name> <jonas-config-property-value>jonas</jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>password</jonas-config-property-name> <jonas-config-property-value>jonas</jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>loginTimeout</jonas-config-property-name> <jonas-config-property-value></jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>URL</jonas-config-property-name> <jonas-config-property-value>jdbc:postgresql://your_host:port/your_db </jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>dsClass</jonas-config-property-name> <jonas-config-property-value>com.p6spy.engine.spy.P6SpyDriver </jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>mapperName</jonas-config-property-name> <jonas-config-property-value>rdb.postgres</jonas-config-property-value> </jonas-config-property> <jonas-config-property> <jonas-config-property-name>logTopic</jonas-config-property-name> <jonas-config-property-value>org.objectweb.jonas.jdbc.DMPostgres </jonas-config-property-value> </jonas-config-property> </jonas-resource> |
In the $JONAS_BASE/conf/spy.properties file:
realdriver=org.postgresql.Driver |
In $JONAS_BASE/conf/trace.properties:
logger.org.objectweb.jonas.jdbc.sql.level DEBUG |