Question

How to enable Oracle JDBC logging in tomcat

Hi ,

we see connectivity issues to database from app server. the issue is sporadic and affect only one node in multi node cluster and it recovers it self after sometime. we have ruled out DB issues and network issues as it affects only one node for a period of time, when other nodes operates normally.. I wanted to enable ojdbc logging and see if I can get clue for this issue.

I have downloaded the oracle jdbc7_g .jar and replaced the jdbc.jar in tomcat lib and made the below changes.

Created config.properties for logging with below setting

ava.util.logging.FileHandler.pattern = /usr/share/tomcat7/logs/jdbc.log

java.util.logging.FileHandler.limit = 50000

java.util.logging.FileHandler.count = 1

java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter

handlers = java.util.logging.ConsoleHandler

java.util.logging.ConsoleHandler.level = ALL

java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

oracle.jdbc.connector.level = FINE

oracle.jdbc.driver.level = FINEST

oracle.jdbc.internal.level = FINE

#oracle.jdbc.oci.level = FINE

#oracle.jdbc.oracore.level = FINE

oracle.jdbc.pool.level = FINE

#oracle.jdbc.rowset.level = FINE

oracle.jdbc.util.level = FINE

#oracle.jdbc.xa.level = FINE

oracle.jdbc.xa.client.level = FINE

#oracle.jpub.level = FINE

#oracle.net.ns.level = TRACE_20

#oracle.sql.level = FINE

Enabled oracle debug logging in tomcat7.conf in Catalina_opts

-Doracle.jdbc.Trace=true -Djava.util.logging.config.file=/usr/share/tomcat7/conf/myConfig.properties

i'm using tomcat 7

but still i'm not seeing the debug logs.. can anyone please let me know if I'm missing anything.

Thanks

Nagendran Arumugam

Correct Answer
November 19, 2019 - 6:40am

I noticed the jvm argument -Djava.util.logging.config.file is twice set in your env, you may want to check on that.

Comments

Keep up to date on this post and subscribe to comments

Pega
November 11, 2019 - 3:20am

Hi,

Can you please set the logging level of class 'com.pega.pegarules.data.internal.store.DatabaseConnectionImpl' to debug from Designer/ Dev studio based on your PRPC version?

For 8.x versions: Configure >> System >> Operations >> Logs >> Logging Level Settings.

For 7.x versions: Designer Studio >> System >> Operations >> Logs.

Thank you,

 

November 18, 2019 - 12:05pm

@goela1 I tried enabling com.pega.pegarules.data.internal.access.DatabaseConnectionImpl , but still i don't see the logs

November 18, 2019 - 9:20pm
Response to NagendranA6739

oracle jdbc trace is generic and has nothing to do with Pega class. Did you confirm the JVM arguments you specified (e.g.

-Doracle.jdbc.Trace=true) is actually taken in your tomcat java process? (run ps -ef|grep java)

November 18, 2019 - 10:35pm
Response to KevinZheng_GCS

Hi Kevin ,

I can see the JVM arguments in java process.

 

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000}
span.s1 {font-variant-ligatures: no-common-ligatures}
span.s2 {font-variant-ligatures: no-common-ligatures; color: #ca3323}

[ nagendran.arumugam]# ps -ef | grep "java"

tomcat    5592     1  2 Nov18 ?        00:14:12 /usr/lib/jvm/jre/bin/java -server -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9080 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -XX:+UseG1GC -XX:MaxPermSize=1024m -Xms12288m -Xmx12288m -Djava.awt.headless=true -verbose:gc -Xloggc:/var/log/tomcat7/gc.log-2019-11-18-17-11 -XX:+UseAdaptiveSizePolicy -XX:+PrintAdaptiveSizePolicy -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -XX:+PrintGCApplicationConcurrentTime -XX:+PrintGCApplicationStoppedTime -XX:+PrintTenuringDistribution -XX:+PrintCommandLineFlags -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=7 -XX:GCLogFileSize=10M -XX:ErrorFile=/usr/share/tomcat7/temp/hs_err.log -XX:HeapDumpPath=/usr/share/tomcat7/temp/catalina.hprof -XX:+HeapDumpOnOutOfMemoryError -Djava.security.egd=file:///dev/urandom -Doracle.jdbc.Trace=true -Djava.util.logging.config.file=/usr/share/tomcat7/conf/myConfig.properties -classpath :/usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar:/usr/share/java/commons-daemon.jar -Dcatalina.base=/usr/share/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat7/temp -Djava.util.logging.config.file=/usr/share/tomcat7/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager org.apache.catalina.startup.Bootstrap start

November 19, 2019 - 6:40am
Response to NagendranA6739

I noticed the jvm argument -Djava.util.logging.config.file is twice set in your env, you may want to check on that.

November 26, 2019 - 9:45am
Response to KevinZheng_GCS

Thanks Kevin, the duplicate entry is being set by start script, once I fixed it logging is working.