选择日志记录提供商

发布于 2025-01-05 22:30:24 字数 606 浏览 3 评论 0原文

我已将我的应用程序配置为将 slf4j 与 log4j 一起使用,但了解如何通过 slf4j 选择 JBoss 记录器:

org.jboss.logging [DEBUG] 日志提供程序:org.jboss.logging.Log4jLoggerProvider。

我的应用程序使用 spring 和 hibernate,据我了解,hibernate 现在使用 JBoss 记录器而不是 slf4j。我有办法强制使用 slf4j 吗?或者更好的是,让我的日志记录调用与 API 无关?就目前而言,hibernate 和 spring 日志正确,但我的应用程序特定的日志记录被忽略,因为它使用 slf4j API。

更新:日志相关的jar(由maven管理)包括:

  1. slf4j-api-1.6.1
  2. slf4j-parent-1.6.1
  3. slf4j-simple-1.6.1
  4. slf4j-log4j12-1.6.1
  5. jboss -logging-3.1.0.CR2
  6. log4j-1.2.12

谢谢。

I had configured my application to use slf4j with log4j, but some how JBoss logger is being selected over slf4j:

org.jboss.logging [DEBUG] Logging Provider: org.jboss.logging.Log4jLoggerProvider.

My application uses spring and hibernate and as I understand it, hibernate now uses JBoss logger instead of slf4j. Is there away for me to force the use of slf4j? Or better yet, make my logging calls API agnostic? As it stands now, hibernate and spring log correctly, but my application specific logging is ignored since it uses the slf4j API.

UPDATE: Logging related jars (which are managed by maven) include:

  1. slf4j-api-1.6.1
  2. slf4j-parent-1.6.1
  3. slf4j-simple-1.6.1
  4. slf4j-log4j12-1.6.1
  5. jboss-logging-3.1.0.CR2
  6. log4j-1.2.12

Thanks.

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

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

发布评论

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

评论(1

一桥轻雨一伞开 2025-01-12 22:30:24

您的类路径中有太多日志记录实现。

显然 Hibernate 使用 SLF4J: 文档< /a>

因此,您应该删除以下 jar:

  • slf4j-simple-1.6.1(它与 slf4j-log4j 冲突)
  • jboss-logging-3.1.0.CR2

我不太确定 slf4j-parent-1.6.1 是什么,您可以尝试使用或不使用它。

You have too many logging implementations in your classpath.

Apparently Hibernate uses SLF4J: documentation

So you should remove the following jars:

  • slf4j-simple-1.6.1 (it conflicts with slf4j-log4j)
  • jboss-logging-3.1.0.CR2

I'm not so sure what slf4j-parent-1.6.1 is, you can try with and without it.

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