使用自己的 log4j 配置在 jboss 中部署的简单 EJB jar

发布于 2024-08-30 15:07:58 字数 536 浏览 1 评论 0原文

我有一个带有无状态会话 bean 的简单 EJB jar,部署在 JBOSS AS 4.2.2 中的 /server/default/deploy 下。从 jboss jmx 控制台查看,该 bean 注册在 JNDI 树下,我可以通过 JBOSS 外部的远程 java 客户端访问它。

在 EJB jar 内,我使用 apache log4j jar 和 log4j.xml 添加了一些要写入单独日志文件的日志记录。但我无法查看任何日志。

另外,我不希望使用 jboss-log4j.xml,因为将部署许多其他 EJB,并且希望为每个 EJB 应用程序拥有单独的 log4j。

这是我的 EJB-jar 内容之一:

EJB_DS.jar: log4j.xml apache log4j jar类

已添加到 /server/default/lib 路径。

请强调我是否遗漏了启用 log4j 配置的任何要点

I have a simple EJB jar with a stateless session bean, deployed in JBOSS AS 4.2.2, under <JBOSS_HOME>/server/default/deploy. The bean is registered under JNDI tree as viewed from jboss jmx console and I am able to access it through a remote java client outside JBOSS.

Inside EJB jar, I have added some logging to be written to a separate log file, using apache log4j jar and log4j.xml. But I am not able to view any of the logs.

Also I do not wish to use jboss-log4j.xml, since there will be many other EJBs to be deployed and wish to have separate log4j for each EJB application.

Here is my one of the EJB-jar contents:

EJB_DS.jar:
log4j.xml
classes

apache log4j jar is added to <JBOSS_HOME>/server/default/lib path.

Kindly highlight if i have missed any points for enabling log4j configuration

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

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

发布评论

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

评论(1

倒数 2024-09-06 15:07:58

不幸的是,这在 JBoss 中不是一个选项。整个服务器运行单个 log4j 配置(由 conf/jboss-log4j.xml 指定),并且您的 EJB 无法更改它。这并不理想,但事实就是如此。

另外,您不需要将 log4j.jar 添加到 server/default/lib,JBoss 已经有自己的内部副本。

This isn't an option in JBoss, unfortunately. The entire server operates off a single log4j configuration (specified by conf/jboss-log4j.xml), and your EJBs cannot change that. It's not ideal, but that's the way it is.

Also, you don't need to add log4j.jar to server/default/lib, JBoss already has its own internal copy.

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