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会先与Spring之前加载日志配置,这时日志文件中的springProfile的配置是无效的。按照官方文档的说法将logback.xml改为logback-spring.xml就可以了。
为什么Spring Boot推荐使用logback-spring.xml来替代logback.xml来配置logback日志的问题分析
最根本的原因:
即,logback.xml加载早于application.properties,所以如果你在logback.xml使用了变量时,而恰好这个变量是写在application.properties时,那么就会获取不到,只要改成logback-spring.xml就可以解决。