英文:
"net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable. when upgrading to spring boot 2
问题
I've upgraded from spring boot 1.5.0 to 2.0.0 and I got this error:
ERROR in ch.qos.logback.core.joran.util.PropertySetter@6f01b95f - A "net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable.
It seems one library needs logback-classic 1.0.13, and spring boot 2.0.0 imports logback-classic 1.2.
I've tried to exclude this library from spring boot, but it seems the application couldn't start without logback-classic...
英文:
I've upgrade from spring boot 1.5.0 to 2.0.0 and I got this error :
> ERROR in ch.qos.logback.core.joran.util.PropertySetter@6f01b95f - A "net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable.
It seems one library needs logback-classic 1.0.13 and spring boot 2.0.0 imports logback-classic 1.2
I've tried to excluse from spring boot this library but it seems the application couldn't start without logback-classic...
答案1
得分: 0
有一个与您描述的类似的Logback问题,可以在这里找到。该问题在版本1.2.5中得到解决。
您可以尝试设置POM中的logback版本属性,使Spring依赖管理使用该版本,即
<properties>
<logback.version>1.2.5</logback.version>
...
</properties>
如果有的话,您可能还需要从您自定义的库依赖中排除所有传递的logback依赖。
如果这没有帮助,尝试将logback依赖项显式添加到POM中,以利用Maven的最近定义逻辑。运行mvn dependency:tree
检查是否选择了正确的版本。
英文:
There was an issue in Logback similar to the one you describe. It was fixed in version 1.2.5.
You can try to set the logback version property in your POM to make the Spring dependency management use that, i.e.
<properties>
<logback.version>1.2.5</logback.version>
...
</properties>
You might also need to exclude all transitive logback dependencies
from your custom lib dependencies if there are any.
If that doesn't help, instead try to add the logback dependency explicitly to your POM to make use of Maven's nearest definition logic.
Run mvn dependency:tree
to check that the proper versions are picked up.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论