通过查看 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/