java - 使用 Weblogic 10.3 记录 JPA SQL

标签 java logging oracle10g weblogic openjpa

通过查看 Open JPA 网站,我发现我可以使用以下方法记录生成的 SQL:

<property name="openjpa.Log" value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO"/>

如果我尝试将上述属性添加到我的 persistence.xml 中,我会从 weblogic 收到以下警告:

<Warning> <J2EE> <BEA-160202> <You have specified a ope
njpa.Log setting in your configuration for persistence unit services.ear#services-ejb.jar#exp#exp. This setting will be ignored, and all log messages
will be sent to the WebLogic logging subsystem. Trace-level logging is controlle
d by the various JPA-specific debug settings in config.xml, or via the WebLogic
console.>

任何人都知道控制台中的选项是什么或者我如何编辑我的 config.xml 以输出 SQL?

最佳答案

来自OTN Discussion forum以下是步骤:

  • Log into the weblogic console
  • Lock and Edit the session
  • Click Environment | Servers
  • Select the server you wish to monitor/debug
  • Click the Debug tab
  • expand the weblogic tree and select the JPA node
  • Click the enable button
  • Activate the changes.

这可能取决于您拥有的 WLS 版本。我知道如果您下载了 newer version of OpenJPA 会出现一些问题并将其与 WLS 一起使用。

撇开 WebLogic 问题不谈,您发布的配置字符串看起来有点不对劲。您是否打算使用类似这样的东西(在 SQL=TRACE 中添加):

<property name="openjpa.Log" 
                value="DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE"/>

关于java - 使用 Weblogic 10.3 记录 JPA SQL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/792741/

相关文章:

java - 如何在数组中存储新的客户端信息并能够在java中再次查看它?

java - 安卓 Java : can switch statement avoid inlining when creating a secret string?

java - 继承类 (Java),显式构造函数错误消息

python - 是否有可能捕获 python 中 try block 中引发的所有警告?

sql - 解决Oracle SQL中的mutating table问题产生死锁

PHP 的 mysql_real_escape_string() 的 Java 等价物

logging - 哪些是运行程序的最佳 Haskell 库?

java - 将异常日志保存到文件中

sql - 获取组内每个条件的单独计数

oracle10g - 将当前 CLOB 列复制到 Oracle 中的新 BLOB 列