English 中文(简体)
使用Weblogic 10.3记录JPA SQL
原标题:
  • 时间:2009-04-27 09:02:18
  •  标签:

By looking into the Open JPA website i ve found that i can log the generated SQL by using the following:

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

Anyone know what is the option in the console or how i can edit my config.xml to output the SQL?

最佳回答

OTN 讨论论坛,以下是步骤:

  • 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.

It might depend on the version of WLS you have. I understand that there were some issues if you ve downloaded a newer version of OpenJPA and are using it with WLS.

暂且不论WebLogic的问题,你发布的配置字符串看起来有点不对。你打算使用类似这样的东西吗(加上了SQL=TRACE):

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

对于Weblogic 10.3.3,还有一些步骤:

  • 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 at the bottom of the page
  • Now click the Logging Tab
  • At the bottom of the page, click Advanced
  • Under Message destination(s) panel, change Severity Level from Standard Out to Debug
  • Save your changes and restart server




相关问题
热门标签