WebLogic 11g 中的 JPA 日志记录 (10.3.1)

发布于 2024-08-09 00:56:53 字数 281 浏览 6 评论 0原文

在 WebLogic 11g 中运行应用程序时,如何启用 OpenJPA 的调试日志记录?我尝试了 Logging JPA SQL with Weblogic 10.3 给出的步骤,但是服务器日志中没有出现 OpenJPA 日志语句。我还仔细阅读了有关日志记录配置的 WebLogic 文档,但不清楚如何为该特定子系统 (JPA) 启用调试日志记录。有什么想法吗?

How do you enable debug logging for OpenJPA when running an application in WebLogic 11g? I tried the steps given by Logging JPA SQL with Weblogic 10.3, but no OpenJPA log statements appear in the server log. I have also poured over the WebLogic documentation regarding the configuration of logging, but am unclear as to how to enable debug logging for this particular subsystem (JPA). Any ideas?

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

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

发布评论

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

评论(3

旧故 2024-08-16 00:56:53

呸!我刚刚解决了这个问题,其原因非常令人沮丧!

当我通过 WebLogic 控制台([我的域] -> 环境 -> 服务器 -> [我的服务器] -> 日志选项卡)为我的服务器配置日志记录时,我在“跟踪”处设置了“要记录的最低严重性”将服务器日志文件的“严重级别”设置为“调试”(两者都是“高级”下的选项)。值得注意的是,“严重性级别”选择框没有提供“跟踪”选项。因此,当我保存配置时,服务器日志级别设置为“调试”。我后来了解到,大多数 Kodo(以及 OpenJPA?)日志记录都处于 Trace 级别,这就是为什么我看不到任何 JPA 日志记录,即使在通过“调试”选项卡启用 JPA 子系统的调试之后也是如此。

“严重性级别”选择框旁边的描述说“默认情况下,所有消息都会进入日志文件”,因此如果我没有尝试配置日志记录,我就不会遇到此问题。为了在服务器日志中查看 Kodo 跟踪日志记录,我必须打开 config.xml 文件 (user_projects\domains[我的域]\config\config.xml) 并删除 下的元素。

因此,我很困惑为什么 WebLogic 控制台不提供“跟踪”作为“日志记录”选项卡“高级”部分下的“严重性级别”选择框的选项。这是一个疏忽,还是我错过了遗漏的充分理由?

BAH! I just fixed this problem, and its cause is quite frustrating!

When I configured Logging for my server via the WebLogic console ([my domain] -> Environment -> Servers -> [my server] -> Logging tab), I set "Minimum severity to log" at "Trace" and "Severity level" for the server log file to "Debug" (both are options under "Advanced"). Notably, the "Severity level" select box did not provide a "Trace" option. Thus, when I saved the configuration, the server log level was set to Debug. I have since learned that most of Kodo's (and OpenJPA's?) logging is at the Trace level, which is why I couldn't see any JPA logging, even after enabling debug for the JPA subsystem via the "Debug" tab.

The description next to the "Severity level" select box says that "By default all messages go to the log file," so if I hadn't tried to configure logging, I wouldn't have encountered this issue. In order to see Kodo trace logging in the server log, I had to open up my config.xml file (user_projects\domains[my domain]\config\config.xml) and remove the element under .

Consequently, I am baffled as to why the WebLogic console doesn't provide "Trace" as an option for the "Severity level" select boxes under the "Advanced" section of the Logging tab. Is this an oversight, or am I missing a good reason for the omission?

魔法少女 2024-08-16 00:56:53

您是否尝试使用 persistence.xml 文件中的以下属性启用详细日志记录:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="openjpa.Log" value="SQL=TRACE"/>
        </properties>
    </persistence-unit>
</persistence>

Did you try to enable verbose logging using the following property in your persistence.xml file:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="openjpa.Log" value="SQL=TRACE"/>
        </properties>
    </persistence-unit>
</persistence>
悲欢浪云 2024-08-16 00:56:53

EclipseLink 的设置:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.level.sql" value="FINE" />
        </properties>
    </persistence-unit>
</persistence>

Settings for EclipseLink:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    version="1.0">
    <persistence-unit name="example-logging" transaction-type="RESOURCE_LOCAL">
        <properties>
            <property name="eclipselink.logging.level" value="FINE" />
            <property name="eclipselink.logging.level.sql" value="FINE" />
        </properties>
    </persistence-unit>
</persistence>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文