During a database upgrade (oracle 10g to 11g) I had to debug a series of JDBC calls. I suspected a performance bottleneck in a database query and decided to look for the offending SQL statement. This is when I started to find how much information there is about JDBC logging. Most places I researched pointed me to p6spy, a nice tool which according to the documentation "intercepts and optionally modifies database statements". This was helpful to determine that the bottleneck was not a SQL statement from our application, but instead a library (open source) which needed metadata information.