Search This Blog

Sunday, March 13, 2011

How to enable JDBC SQL Statement Tracing in OC4J

Take a backup of ojdbc14.jar and  ojdbc14dms.jar files.

cd ORACLE_HOME\jdbc\lib

copy ojdbc14.jar ojdbc14.jar.org
copy  ojdbc14dms.jar ojdbc14dms.jar.org

Replace the  JDBC jar files with the JDBC log files
copy ojdbc14dms_g.jar ojdbc14dms.jar
copy ojdbc14_g.jar ojdbc14.jar

In the opmn.xml add the following values to the opmn.xml file
-Doracle.jdbc.Trace=true -Djava.util.logging.config.file=c:/temp/OracleLog.properties
 
 
For example ,

<process-type id="oc4j_soa" module-id="OC4J" status="enabled">
               <module-data>
                  <category id="start-parameters">
<data id="java-options" value=" -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=c:/temp/OracleLog.properties   -Xrs -server -XX:MaxPermSize=128M -ms512M -mx1024M -XX:AppendRatio=3 -Djava.security.policy=$ORACLE_HOME/j2ee/oc4j_soa/config/java2.policy -Djava.awt.headless=true -Dhttp.webdir.enable=false -Doraesb.home=d:\soa1013\integration\esb -Dhttp.proxySet=false -Doc4j.userThreads=true -Doracle.mdb.fastUndeploy=60 -Doc4j.formauth.redirect=true -Djava.net.preferIPv4Stack=true -Dorabpel.home=d:\soa1013\bpel -Xbootclasspath^/p:d:\soa1013\bpel/lib/orabpel-boot.jar -Dhttp.proxySet=false"/>                  </category>
                  <category id="stop-parameters">
         

Sample OracleLog.properties  file
==================================

#### 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

oracle.level=OFF
#oracle.jdbc.driver.level=CONFIG
#oracle.sql.level = FINEST


#set JAVA_OPTIONS=-Doracle.jdbc.Trace=true  -Djava.util.logging.config.file=c:/temp/OracleLog.properties

No comments: