OpenJPA 在 WAS 7 上部署时不记录日志

发布于 2024-09-30 15:03:58 字数 1281 浏览 3 评论 0原文

我已将我的应用程序部署到WebSphere Application Server 7,它使用应用程序服务器中的默认OpenJPA 1.2.2库,但是,我无法记录它,我在persistence.xml中有这个

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
  xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="SvcsLogic" transaction-type="JTA">
   <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
   <jta-data-source>jdbc/mydatasource</jta-data-source>
   <exclude-unlisted-classes>true</exclude-unlisted-classes>
   <properties>
   <property name="openjpa.log" value="log4j, DefaultLevel=TRACE" />
   <property name="openjpa.Log" value="log4j, DefaultLevel=TRACE" />

   <property name="openjpa.jdbc.SynchronizeMappings"
      value="buildSchema(SchemaAction='add',foreignKeys=true)" />
   </properties>
</persistence-unit>
</persistence>

但是,它会忽略以下事实:我希望它使用 log4j 进行记录,即使我删除 log4j 设置,它也不会修改 WAS 的日志和跟踪中的日志记录通道。我已经将所有内容设置为记录所有内容只是为了确保,但它不起作用。

这是否意味着我必须更改 JPA 实现才能使日志记录正常工作?如果是这样,这就显得相当草率了。

I have deployed my application to WebSphere Application Server 7, it uses the default OpenJPA 1.2.2 library in the application server, however, I cannot get it to log, I have this in my persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
  xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence    http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="SvcsLogic" transaction-type="JTA">
   <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
   <jta-data-source>jdbc/mydatasource</jta-data-source>
   <exclude-unlisted-classes>true</exclude-unlisted-classes>
   <properties>
   <property name="openjpa.log" value="log4j, DefaultLevel=TRACE" />
   <property name="openjpa.Log" value="log4j, DefaultLevel=TRACE" />

   <property name="openjpa.jdbc.SynchronizeMappings"
      value="buildSchema(SchemaAction='add',foreignKeys=true)" />
   </properties>
</persistence-unit>
</persistence>

However, it will ignore the fact that I want it to log using log4j, even if I remove the log4j setting it won't modify the logging channels in WAS' Logs and Trace. I have it all set to log everything just to make sure, and it doesn't work.

The WAS Infocenter doc on JPA Logging says, however Avoid trouble: The “openjpa.Log” property will be ignored if it is defined in a container-managed persistence unit that uses the persistence providers that are provided with the application server. In this case you must use the standard trace specification for the application server.

Does this mean I have to change my JPA implementation just to get logging working? If so, this seems rather sloppy.

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

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

发布评论

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

评论(1

熟人话多 2024-10-07 15:03:58

在我看来,了解 OpenJPA 在 WebSphere v7 中幕后所做的事情的唯一方法是在管理控制台中启用跟踪。

要在管理控制台中激活 OpenJPA 跟踪,请导航至故障排除 - 日志和跟踪 - [您的服务器] - 诊断跟踪。在配置页面上,单击右侧的“更改日志详细级别”。展开组件树并选择 OpenJPA 日志详细信息级别

*=info: openjpa.Query=all: openjpa.jdbc_JDBC=all: openjpa.jdbc_SQL=all

在文本字段中输入。单击“确定”,然后单击“保存”。您必须重新启动服务器。

In my opinion the only way to see what OpenJPA is doing behind the scenes in WebSphere v7 is to enable tracing in the admin console.

In order to activate OpenJPA tracing in the admin console, navigate to Troubleshooting - Logs and trace - [your server] - Diagnostic Trace. On the Configuration page, click on "Change Log Detail Levels" on the right side. Expand the components tree and select the OpenJPA log detail levels or enter

*=info: openjpa.Query=all: openjpa.jdbc_JDBC=all: openjpa.jdbc_SQL=all

into the text field. Click "OK" and then "save". You have to restart the server.

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