如何在JBoss5中使用log4j设置DBAppender?

发布于 2024-09-16 01:04:17 字数 528 浏览 1 评论 0原文

我希望能够设置集群 JBoss5 实例以将 log4j 消息写入数据库。我正在尝试使用 DBAppender (而不是 JDBCAppender,原因如下在这个问题中给出)。

有人这样做过吗?截至目前,我已向 jboss-log4j.xml 添加了 标记,并将 logback-classic-0.9.17.jar 文件放入 JBoss 目录中每个包含 jar 的文件夹中,但当 JBoss 尝试在启动时查找它时,我仍然收到 ClassNotFoundException。

您可以给我的任何提示/示例都可能会有所帮助,无论是让我在这个方向上走得更远,还是为我指明更好的方向。

I would like to be able to set up my clustered JBoss5 instances to write log4j messages to a database. I am trying to use a DBAppender (rather than a JDBCAppender, for the reasons given in this question).

Has anyone done this? As of now, I've added an <appender> tag to jboss-log4j.xml and put the logback-classic-0.9.17.jar file in every jar-filled folder in my JBoss directory, but I'm still getting a ClassNotFoundException when JBoss tries to look for it on startup.

ANY tips/examples you can give me might be helpful, either in getting me farther in this direction, or pointing me in a better direction.

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

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

发布评论

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

评论(1

九八野马 2024-09-23 01:04:18

引用 David Lloyd 在 Jboss 论坛此帖子中的回答:

(...) 真正的问题是“如何配置 JBoss AS 5.1.0 以使用 LogBack?”。答案是,没有; log4j 是所有 AS 5.x 版本中唯一受支持的日志记录后端。

看起来很清楚:您无法将 JBoss 配置为使用 logback,因此无法配置其 DBAppender

因此,如果您确实想登录到数据库,恐怕您必须采用 JDBCAppender 方式 (Log4j)。但我会对此进行思考(或者至少认真对待它)。

以防万一,也许可以看看 JBLOGGING-6

Quoting an answer from David Lloyd in this thread on the Jboss forums:

(...) The real question would be "how does one configure JBoss AS 5.1.0 to use LogBack?". The answer to that is, one doesn't; log4j is the only supported logging backend in all AS 5.x releases.

Seems pretty clear: you can't configure JBoss to use logback and, as a consequence, its DBAppender.

So I'm afraid you'll have to go the JDBCAppender way (Log4j) if you really want to log to a database. But I would think twite about this (or at least bench it seriously).

Just in case, maybe have a look at JBLOGGING-6.

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