Wednesday, January 11, 2012

Enabling and Using JDBC Logging


Set the classpath variables in setDomainEnv.sh file under the following header
# ADD EXTENSIONS TO CLASSPATHS
On Windows
set EXT_PRE_CLASSPATH=C:\Oracle\Middleware\wlserver_10.3\server\ext\jdbc\oracle\11g\ojdbc6_g.jar 
set JAVA_OPTIONS=-Doracle.jdbc.Trace=true -Djava.util.logging.config.file=c:/temp/OracleLog.properties 


On Unix
EXT_PRE_CLASSPATH="${EXT_PRE_CLASSPATH}${CLASSPATHSEP}/reuters/oracle/product/soa/11g/fmw/wlserver_10.3/server/ext/jdbc/oracle/11g/ojdbc6_g.jar"
JAVA_OPTIONS="${JAVA_OPTIONS} -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=/reuters/oracle/as01/fmw/config/admin/domains/deployplan/OracleLog.properties "

In the OracleLog.properties have the following entries ,
#### Console Handler ######
#java.util.logging.ConsoleHandler.level = ALL 
#java.util.logging.ConsoleHandler.formatter =
 
#java.util.logging.SimpleFormatter
 
#handlers = java.util.logging.ConsoleHandler
#### File  Handler ######
oracle.jdbc.handlers=java.util.logging.FileHandler 
java.util.logging.FileHandler.level=ALL
 
java.util.logging.FileHandler.pattern=c:/temp/jdbc.log
 
java.util.logging.FileHandler.count=1
 
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Uncomment and/or change the levels for more detail 
#oracle.jdbc.level = FINEST
 
#oracle.jdbc.connector.level = FINE
 
#oracle.jdbc.driver.level = FINEST
 
#oracle.jdbc.internal.level = FINEST
 
#oracle.jdbc.oci.level = FINE
 
#oracle.jdbc.oracore.level = FINE
 
#oracle.jdbc.pool.level = FINE
 
#oracle.jdbc.rowset.level = FINEST
 
#oracle.jdbc.util.level = FINEST
 
#oracle.jdbc.xa.level = FINE
 
#oracle.jdbc.xa.client.level = FINE
 
#oracle.jpub.level = FINE
 
#oracle.net.level = FINE
 
#oracle.sql.level = FINEST
 
#.level=CONFIG
 
#oracle.level=CONFIG
 
#oracle.jdbc.pool.level=CONFIG
 
#oracle.jdbc.util.level=CONFIG
 
#oracle.sql.level=CONFIG
#oracle.jdbc.driver.level=FINE

# This is the setting needed for sql debug
 
oracle.jdbc.driver.level=FINE
 
oracle.level=OFF
 If you want only the sql statements without bind variables use 
oracle.jdbc.driver.level=CONFIG

No comments:

Post a Comment