从log4j2桥接到slf4j [英] Bridging from log4j2 to slf4j
问题描述
我在我的应用程序(这是一个Dropwizard应用程序)中将Slf4j 1.7.x与Logback结合使用.现在,我们有了使用log4j2(而不是log4j)的库,日志记录转到了/dev/null
.在任何现有的Maven应用程序中都找不到logj2-over-slf4j
或log4j2-to-slf4j
库,诀窍是什么?
I'm using Slf4j 1.7.x in conjunction with Logback in my applications (it is a Dropwizard-application). Now we have libraries that use the log4j2 (not log4j), and the logging goes to /dev/null
. I can't find a logj2-over-slf4j
or log4j2-to-slf4j
library in any exising maven application, what is the trick?
推荐答案
您可以使用 Log4j 2到SLF4J适配器,以将Log4j2日志路由到slf4j实现.没错,slf4j本身不提供log4j2的适配器.
You may use the Log4j 2 to SLF4J Adapter to route your Log4j2 logs to your slf4j implementation. You are right that slf4j itself does not provide an adapter for log4j2.
这篇关于从log4j2桥接到slf4j的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!