Database Reference
In-Depth Information
Several things about that command line are worth mentioning. The directive -
Doracle.jdbc.Trace=true turns on trace logging. Notice the ojdbc6_g.jar in the CLASSPATH, -cp directive.
Using that jar file enables logging. We also have the oraclepki.jar file on the CLASSPATH for enabling the
wallet.
The -Djava.util.logging.config.file=OracleLog.properties directive tells the logging classes to
find their properties settings in a file named OracleLog.properties . An example properties file for logging
may have the entries shown in Listing 11-14.
Listing 11-14. Configure Java (ojdbc) Trace Logging, OracleLog.properties
handlers = java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
.level=CONFIG
oracle.jdbc.level = FINE
oracle.jdbc.connector.level = FINE
oracle.jdbc.driver.level = FINE
oracle.jdbc.pool.level = FINE
oracle.net.ns.level = TRACE_20
Note You will find a complete configuration properties file at Chapter11/wallet/OracleLog.properties.
The first three property lines configure the console (command prompt window) as a logging
handler. The ConsoleHandler.level = ALL directive indicates that we want everything that's generated
to go to the console. That is my preference. Then, if there's too much logging data coming at me, I can
redirect it to a file. The last portion of the command line shows a redirect of the two standard output
streams of data, which normally come to the command prompt window, > temp.txt 2> temp2.txt . The
first greater-than symbol redirects the “standard out” stream to a file named temp.txt in the current
directory. The second greater-than symbol, with the “2” prefix redirects the “standard err” stream to a
file named temp2.txt . You can send both these streams to the same file with this directive at the end of a
command: > temp.txt 2> &1.
The last few lines of the properties file configure the level of detail of trace logging. The first
property, .level=CONFIG , sets a default level of logging for all aspects of the ojdbc classes to use. CONFIG
level is medium detail. The other levels are set at FINE and TRACE_20 , which are more detailed levels. The
example OracleLog.properties file lists of all the aspects to which logging applies, and all the levels that
can be set.
With the setting provided in OracleLog.properties , a very large trace output is generated in temp2.txt.
The following lines are just a snippet of the output produced:
Jul 9, 2011 8:32:37 AM oracle.jdbc.pool.OracleDataSource <init>
TRACE_1: Public Enter:
Jul 9, 2011 8:32:37 AM oracle.jdbc.pool.OracleDataSource <init>
TRACE_1: Exit
Jul 9, 2011 8:32:37 AM oracle.jdbc.pool.OracleDataSource setURL
TRACE_1: Public Enter: "jdbc:oracle:thin:@orcl_appusr"
Jul 9, 2011 8:32:37 AM oracle.jdbc.pool.OracleDataSource setURL
TRACE_1: Exit
 
Search WWH ::




Custom Search