Friday, May 21, 2010

How to Turn on Ojdbc Driver Debug Logging

It had been a while since I turned on ojdbc trace logging, so I had to look it up. Found a great article called Turning on Oracle Driver Tracing by Kualigan and added my notes below. I didn't use the Sun Java Logging API part of it.

If you need to turn on Oracle JDBC driver debug or trace logging, you first need to install the ojdbc driver "g" jar provided by Oracle (for example, ojdbc14_g.jar).

If using Maven 2 and you don't want to make changes to your pom.xml(s), you could just swap out the version in your local repo with the debug version, but that may cause you later to accidentally include the debug version in another project, so I just changed the version in my pom.xml to a version I knew I didn't have called "" (because I downloaded the ojdbc v9.2.0.8 debug driver).


Then when I rebuilt, I used the command Maven 2 told me to use to manually install that jar.

mvn install:install-file -DartifactId=ojdbc14 -Dversion= -Dpackaging=jar -Dfile=/Users/myuser/Downloads/ojdbc14_g.jar

Then if you are trying to trace in a functional test run by Maven, you modify pom.xml's surefire plugin config in its build plugins to turn on trace logging and specify a Java logging API config file:


More info:
* Turning on Oracle Driver Tracing

No comments: