ひろとしの徒然日記 OracleJDBCトレースの設定
Oracle JDBC FAQ

How do I turn on the trace?
The simplest way to turn the trace on programatically is to call

oracle.jdbc.driver.OracleLog.startLogging();

This sends the trace to System.out. To turn it off call

oracle.jdbc.driver.OracleLog.stopLogging();

You can also turn on the trace by setting the system property oracle.jdbc.Trace to "true".

java -Doracle.jdbc.Trace=true MyApp

Setting any of the other JDBC Trace Facility properties described below implicitly sets oracle.jdbc.Trace to "true".