Weblogic中2只耳朵的Log4j日志记录问题

发布于 2024-09-17 20:09:48 字数 401 浏览 5 评论 0原文

我在 Weblogic 10 中部署了 2 个耳朵,A 和 B。在它们中我都有一个“log4j.properties”文件。启动时,当第一个耳朵加载时,日志位于正确的文件“A.log”中,但是当第二个耳朵加载时,所有日志都将转到“B.log”文件中,甚至是与该耳朵相关的日志第一耳。 我错过了一些东西...知道吗?

谢谢

编辑/解决方案: 类加载器问题。 添加到 weblogic-application.xml :

;org.apache.log4j.*

谢谢大家:)

I'm deploying 2 ears in Weblogic 10, A and B. In both of them I have a "log4j.properties" file. At the startup, when the first ear is loading, the logs are to the right file "A.log", but when the second ear is loading, all logs are going to the "B.log" file, even logs related to the first ear.
I missed something... any idea ?

Thanks

Edit/Solution :
Classloader issue.
Add to the weblogic-application.xml :

<wls:prefer-application-packages>
<wls:package-name>org.apache.log4j.*</wls:package-name>
</wls:prefer-application-packages>

Thks to everyone :)

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

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

发布评论

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

评论(2

八巷 2024-09-24 20:09:48

我猜测 Weblogic 服务器使用的 log4j 库也在您的两个 Web 应用程序中使用。

如果是这种情况,两个 Web 应用程序将共享一个根类加载器,为 Weblogic 加载的全局库提供服务。

如果您的 Web 应用程序每个都提供 log4j 的副本,并且您可以选择在服务器类之前加载应用程序类(我不知道 Weblogic,但对于 WebSphere,设置是“类加载器模式:父级优先/父级最后”)可能会解决你的问题。

It would be my guess that the log4j library that is used by the Weblogic server is used in both your web applications.

If this is the case, both web apps would share a root classloader serving the global libraries loade by Weblogic.

If your web apps each provide a copy of log4j, and if you can choose to load the application classes before the server classes (I don't know Weblogic but for WebSphere the setting is 'classloader mode: parent first / parent last') that might solve your problem.

灼疼热情 2024-09-24 20:09:48

老实说,从这里很难判断,但您可以尝试以下操作:

1)检查两个 log4j 属性文件中的记录器名称是否唯一。
2)我认为.properties文件没有缓存在磁盘上,但仍然删除应用程序
部署目录(两个 EAR 的目录应该是分开的)

Honestly it's hard to tell from here but you can try these:

1) check if the logger names in both of your log4j property files are unique.
2) I think that the .properties file are not cached on disk but still deleting the application
deployment directories (should be separate for both the EAR's )

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