springboot 整合logback

真是处处都是坑,一步一个坑。

因为log4j2的漏洞暴露的原因,整改项目中的所有使用log4j2的日志打印,更换为logback

结果代码更换完后,项目直接启动不起了

直接上报错:

09:39:22,934 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:100 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
09:39:22,940 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@18:143 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
09:39:22,941 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@27:114 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
09:39:22,941 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@28:113 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]
09:39:22,941 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@29:124 - no applicable action for [springProperty], current ElementPath is [[configuration][springProperty]]

原因是我用的配置文件名称为logback.xml,导致项目启动时先加载logback后加载application.properties 导致放在application.properties读取不到所以报错。

结果将logback.xml改为logback-spring.xml就可以了

参考:https://blog.csdn.net/qq_17394183/article/details/89920053

posted @ 2021-12-17 14:25  半柠檬  阅读(198)  评论(0编辑  收藏  举报