问题描述
我在我的应用程序中将 Slf4j 1.7.x 与 Logback 结合使用(它是一个 Dropwizard 应用程序).现在我们有了使用 log4j2(不是 log4j)的库,并且日志记录到 /dev/null.我在任何现有的 maven 应用程序中都找不到 logj2-over-slf4j 或 log4j2-to-slf4j 库,有什么窍门?
推荐答案
您可以使用 Log4j 2 到 SLF4J 适配器 将您的 Log4j2 日志路由到您的 slf4j 实现.没错,slf4j 本身并没有为 log4j2 提供适配器.
问题描述
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?
推荐答案
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.
相关标签/搜索