JPA 2.0(日志记录和跟踪)与 Glassfish 3.0.1 和 NetBeans 6.9.1:

发布于 2024-10-11 22:09:50 字数 303 浏览 4 评论 0原文

我正在将 JPA 2.0EclipseLink 提供程序)与 Glassfish v3.0.1NetBeans 6.9.1 一起使用,但我不是能够查看 JPA 2.0 中的查询和其他日志记录信息。本质上我希望能够看到 JPA 生成的所有 SQL 语句以及其他相关的调试信息...

是否有人成功地能够配置日志记录以提供此类反馈?我已经尝试了几件事但无济于事......

任何帮助将不胜感激。

非常感谢。

I am using JPA 2.0 (EclipseLink provider) with Glassfish v3.0.1 and NetBeans 6.9.1 and am NOT able to see the queries and other logging information from JPA 2.0. Essentially I want to be able to see all the SQL statements which are being generated by JPA and other related debugging information...

Has anyone successfully been able to configure the logging to provide such feedback? I've tried several things to no avail...

Any help would be greatly appreciated.

Thanks much.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

渡你暖光 2024-10-18 22:09:50

最终对我有用的是:

<property name="eclipselink.logging.logger"
     value="org.eclipse.persistence.logging.DefaultSessionLog"/>

in conjunction with your recommended tag of:

<property name="eclipselink.logging.level" value="FINE" />

This allowed me to see the relevant JPA logs which in NetBeans output window. This also worked in Eclipse. The output was sent do the console window an intermingled with the server's output which was exactly what I wanted.

What eventually had done the trick for me was using:

<property name="eclipselink.logging.logger"
     value="org.eclipse.persistence.logging.DefaultSessionLog"/>

in conjunction with your recommended tag of:

<property name="eclipselink.logging.level" value="FINE" />

This allowed me to see the relevant JPA logs which in NetBeans output window. This also worked in Eclipse. The output was sent do the console window an intermingled with the server's output which was exactly what I wanted.

太阳男子 2024-10-18 22:09:50

您必须在 persistence.xml 文件中配置日志记录级别。

示例:

<persistence-unit name="MY_POOL_NAME" transaction-type="JTA">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>MY_JTA_SOURCE</jta-data-source>
    <properties>
        <property name="eclipselink.logging.level" value="FINE" />
        <property name="eclipselink.target-server" value="SunAS9"/>
    </properties>
  </persistence-unit>

日志级别:
关闭
严重
警告
信息
配置 - 将其用于生产
很好
更细
最好的
更多信息: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging< /a>

所有查询都将打印在域 server.log 文件中。

You must configure logging level in persistence.xml file.

Example:

<persistence-unit name="MY_POOL_NAME" transaction-type="JTA">
  <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>MY_JTA_SOURCE</jta-data-source>
    <properties>
        <property name="eclipselink.logging.level" value="FINE" />
        <property name="eclipselink.target-server" value="SunAS9"/>
    </properties>
  </persistence-unit>

Log Levels:
OFF
SEVERE
WARNING
INFO
CONFIG - Use this for Production
FINE
FINER
FINEST
More info: http://wiki.eclipse.org/EclipseLink/Examples/JPA/Logging

All the queries would be printed in the domain server.log file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文