"net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable. when upgrading to spring boot 2

huangapple go评论57阅读模式
英文:

"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...
"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 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...
"net.logstash.logback.encoder.LogstashEncoder" object is not assignable to a "ch.qos.logback.core.Appender" variable. when upgrading to spring boot 2

答案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.

huangapple
  • 本文由 发表于 2023年3月3日 20:59:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/75627393.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定