转载此文请保留原作者信息及出处: http://www.tonyxu.net
最近遇到了一个问题,需要查看比较详细的jdbc log,最好是能看到故障时间点的sql,但是weblogic8.1版本的jdbc.log并不能拿到我们需要的信息(信息量太少)。下面提供一种可以打印详细jdbc log的方法,但是是否对解决我的问题有帮助,还需进一步的分析。
该方法如下:
1. Create a new file and put the following entries(properties) into the file
handlers=java.util.logging.ConsoleHandler,java.util.logging.FileHandler
java.util.logging.FileHandler.pattern = jdbc.log
java.util.logging.FileHandler.limit = 50000
java.util.logging.FileHandler.count = 1
java.util.logging.FileHandler.formatter = java.util.logging.XMLFormatter
java.util.logging.ConsoleHandler.level = SEVERE
java.util.logging.ConsoleHandler.formatter =java.util.logging.SimpleFormatter
oracle.jdbc.level = FINE
2. Make sure $ORACLE_HOME/jdbc/lib/ojdbc14_g.jar file is included in the CLASSPATH environment variable instead of ojdbc14.jar file.
Please download ojdbc14_g.jar in following link and add it to the beginning of classpath
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-10201-088211.html
.
3. Enable tracing by adding following option to “JAVA_OPTIONS” in weblogic start script:
-Doracle.jdbc.Trace=true -Djava.util.logging.config.file={path to properties file location} {class file name} -Doracle.jdbc.LogFile=<path to jdbc log>/jdbc.log
如果对解决问题有进展,我会更新此文章。