Oracle JDBC Debugging

You will need the _g version of the jdbc driver, the standard jdbc drivers don’t support enabling logging.

In order to get some low level debugging from the Oracle JDBC drivers you need some java util logging magic.  I am not sure if this is just because our app uses SLF4J and LOG4J, but I had to add the following environment variables to the jsw wrapper.con file.  I could not get the logging working without all 3 of those lines

wrapper.java.additional.6=-Doracle.jdbc.Trace=true
wrapper.java.additional.7=-Djava.util.logging.configureByLoggingPropertiesFile=true
wrapper.java.additional.8=-Djava.util.logging.config.file=/tmp/OracleLog.properties

And then the contents of the OracleLog.properties file are:

handlers = java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = /tmp/jdbc.log
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
oracle.jdbc.driver.level = FINE

But the problem is that all I actually wanted was the OracleDriver connect entries to find out how long a connection was taking to construct.  Time for some grep magic I think.

Unfortunately I am restricted to java 6 for this particular installation and so the log file outputs entries on more than one line so its harder to parse.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *