选择日志记录提供商
我已将我的应用程序配置为将 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管理)包括:
- slf4j-api-1.6.1
- slf4j-parent-1.6.1
- slf4j-simple-1.6.1
- slf4j-log4j12-1.6.1
- jboss -logging-3.1.0.CR2
- 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:
- slf4j-api-1.6.1
- slf4j-parent-1.6.1
- slf4j-simple-1.6.1
- slf4j-log4j12-1.6.1
- jboss-logging-3.1.0.CR2
- log4j-1.2.12
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的类路径中有太多日志记录实现。
显然 Hibernate 使用 SLF4J: 文档< /a>
因此,您应该删除以下 jar:
我不太确定 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:
I'm not so sure what slf4j-parent-1.6.1 is, you can try with and without it.