sekift/change-log-level

SLF4J依赖冲突问题

Opened this issue · 1 comments

启动单元测试后提示:
SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/D:/ProgramFile/Java/repository/ch/qos/logback/logback-classic/1.1.11/logback-classic-1.1.11.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/ProgramFile/Java/repository/org/slf4j/slf4j-log4j12/1.7.29/slf4j-log4j12-1.7.29.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/D:/ProgramFile/Java/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.9.1/log4j-slf4j-impl-2.9.1.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
如果要兼容各个框架的日志,那这个依赖问题该怎么解决呢

这个问题可能无法简单解决,本人想到两种方法,1、修改slf4j的扫包机制,让其按照配置选择具体实现;2、分module实现log4j/log4j2/logback,再按需引入相应的项目即可。简单实现请看:change-log-level-pro