Enabling JDBC Tracing for Liberty
JDBC tracing for Liberty is enabled either through a driver-specific custom trace setting, or using the application server supplemental JDBC tracing option.
In version 22.0.0.6 and later, see the
documentation for JDBC driver tracing on the Open
Liberty website.
About this task
There are two ways of using driver-specific custom trace facilities:
- Using the Java™ built-in logging mechanism,
java.util.logging
, if the driver supports it. - Configuring a custom trace setting as a vendor property.
If you enable tracing by using either a custom vendor property or supplemental JDBC tracing, you
must add the logwriter name to the trace specification in the
bootstrap.properties file. You can use any of the following logwriters:
- DB2®
- com.ibm.ws.db2.logwriter
- Derby
- com.ibm.ws.derby.logwriter
- Informix® JCC (uses the same driver as DB2)
- com.ibm.ws.db2.logwriter
- Informix JDBC
- com.ibm.ws.informix.logwriter
- Microsoft SQL Server JDBC Driver
- com.ibm.ws.sqlserver.logwriter
- DataDirect Connect for JDBC for Microsoft SQL Server
- com.ibm.ws.sqlserver.logwriter
- Sybase
- com.ibm.ws.sybase.logwriter
- Other databases (for example solidDB and MySQL)
- com.ibm.ws.database.logwriter
Because changes to trace enablement involve altering the bootstrap.properties file, you must restart the server for the changes to take effect.
Avoid trouble: Before you set a trace specification in the
bootstrap.properties file, remove any trace specification from the server.xml
file. Otherwise, in your trace log file, you see that initially the bootstrap setting takes effect
and afterward, the server.xml setting overwrites this bootstrap setting. The
useful logs are potentially lost.
The following examples illustrate the use of the various JDBC trace methods.