当前位置:   article > 正文

logback使用spring配置,启动报错_自定义appender类写入logback-spring.xml配置就启动失败是怎么回事

自定义appender类写入logback-spring.xml配置就启动失败是怎么回事

项目场景:

一个小项目,单体的springboot足以支撑,不想搞得太复杂,不准备使用docker容器部署,打算直接jar包启动。
日志呢,肯定不能配置相对路径了,但是如果配置了绝对路径 ,开发用windows系统、测试用的linux系统,文件系统不一致,日志的路径就不好配置死了,所以搜了一下,可以加springProperty标签读取spring的配置,我就直接在logback.xml里加了一个
在这里插入图片描述

问题描述

加了之后发现启动会报错,不过日志可按配置正常写到对应的路径下,不过还是要研究下原因

09:39:05,969 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_info] - Failed to create parent directories for [C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\info.log]
09:39:05,970 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_info] - openFile(C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools/info.log,true) call failed. java.io.FileNotFoundException: C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\info.log (文件名、目录名或卷标语法不正确。)
	at java.io.FileNotFoundException: C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\info.log (文件名、目录名或卷标语法不正确。)
	at 	at java.io.FileOutputStream.open0(Native Method)
	at 	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at 	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at 	at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:26)
	at 	at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:204)
	at 	at ch.qos.logback.core.FileAppender.start(FileAppender.java:127)
	at 	at ch.qos.logback.core.rolling.RollingFileAppender.start(RollingFileAppender.java:100)
	at 	at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at 	at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
	at 	at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
	at 	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:202)
09:39:05,970 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
09:39:05,970 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [file_error]
09:39:05,971 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@360207322 - No compression will be used
09:39:05,971 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@360207322 - Will use the pattern C:/Python310/Scripts/;C:/Python310/;C:/Program Files (x86)/Common Files/Oracle/Java/javapath;C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/WindowsPowerShell/v1.0/;C:/Windows/System32/OpenSSH/;C:/Program Files (x86)/NVIDIA Corporation/PhysX/Common;C:/Program Files/NVIDIA Corporation/NVIDIA NvDLISR;D:/Java/jdk1.8.0_171/bin/;D:/Java/jdk1.8.0_171/jre/bin/;D:/PuTTY/;D:/Git/cmd;D:/TortoiseGit/bin;D:/maven-3.6.3/bin/;C:/ProgramData/chocolatey/bin;D:/nodejs/;D:/mysql-8.0.28-winx64/bin;D:/Redis;D:/erl-24.1.7;D:/NetSarang/Xshell 7/;D:/NetSarang/Xftp 7/;D:/wget;D:/gradle-6.9.3/bin;C:/Program Files/dotnet/;C:/Users/25463/AppData/Local/Microsoft/WindowsApps;;D:/JetBrains/IntelliJ IDEA 2020.1/bin;;C:/Users/25463/AppData/Roaming/npm;C:/Users/25463/.dotnet/tools/error.%d{yyyy-MM-dd}.log for the active file
09:39:05,971 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - The date pattern is 'yyyy-MM-dd' from file name pattern 'C:/Python310/Scripts/;C:/Python310/;C:/Program Files (x86)/Common Files/Oracle/Java/javapath;C:/Windows/system32;C:/Windows;C:/Windows/System32/Wbem;C:/Windows/System32/WindowsPowerShell/v1.0/;C:/Windows/System32/OpenSSH/;C:/Program Files (x86)/NVIDIA Corporation/PhysX/Common;C:/Program Files/NVIDIA Corporation/NVIDIA NvDLISR;D:/Java/jdk1.8.0_171/bin/;D:/Java/jdk1.8.0_171/jre/bin/;D:/PuTTY/;D:/Git/cmd;D:/TortoiseGit/bin;D:/maven-3.6.3/bin/;C:/ProgramData/chocolatey/bin;D:/nodejs/;D:/mysql-8.0.28-winx64/bin;D:/Redis;D:/erl-24.1.7;D:/NetSarang/Xshell 7/;D:/NetSarang/Xftp 7/;D:/wget;D:/gradle-6.9.3/bin;C:/Program Files/dotnet/;C:/Users/25463/AppData/Local/Microsoft/WindowsApps;;D:/JetBrains/IntelliJ IDEA 2020.1/bin;;C:/Users/25463/AppData/Roaming/npm;C:/Users/25463/.dotnet/tools/error.%d{yyyy-MM-dd}.log'.
09:39:05,971 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Roll-over at midnight.
09:39:05,972 |-INFO in c.q.l.core.rolling.DefaultTimeBasedFileNamingAndTriggeringPolicy - Setting initial period to Wed Jul 26 09:39:05 CST 2023
09:39:05,972 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
09:39:05,972 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file_error] - Active log file name: C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools/error.log
09:39:05,972 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[file_error] - File property is set to [C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools/error.log]
09:39:05,973 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error] - Failed to create parent directories for [C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\error.log]
09:39:05,973 |-ERROR in ch.qos.logback.core.rolling.RollingFileAppender[file_error] - openFile(C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools/error.log,true) call failed. java.io.FileNotFoundException: C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\error.log (文件名、目录名或卷标语法不正确。)
	at java.io.FileNotFoundException: C:\Python310\Scripts\;C:\Python310\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;D:\Java\jdk1.8.0_171\bin\;D:\Java\jdk1.8.0_171\jre\bin\;D:\PuTTY\;D:\Git\cmd;D:\TortoiseGit\bin;D:\maven-3.6.3\bin\;C:\ProgramData\chocolatey\bin;D:\nodejs\;D:\mysql-8.0.28-winx64\bin;D:\Redis;D:\erl-24.1.7;D:\NetSarang\Xshell 7\;D:\NetSarang\Xftp 7\;D:\wget;D:\gradle-6.9.3\bin;C:\Program Files\dotnet\;C:\Users\25463\AppData\Local\Microsoft\WindowsApps;;D:\JetBrains\IntelliJ IDEA 2020.1\bin;;C:\Users\25463\AppData\Roaming\npm;C:\Users\25463\.dotnet\tools\error.log (文件名、目录名或卷标语法不正确。)
	at 	at java.io.FileOutputStream.open0(Native Method)
	at 	at java.io.FileOutputStream.open(FileOutputStream.java:270)
	at 	at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
	at 	at ch.qos.logback.core.recovery.ResilientFileOutputStream.<init>(ResilientFileOutputStream.java:26)
	at 	at ch.qos.logback.core.FileAppender.openFile(FileAppender.java:204)
	at 	at ch.qos.logback.core.FileAppender.start(FileAppender.java:127)
	at 	at ch.qos.logback.core.rolling.RollingFileAppender.start(RollingFileAppender.java:100)
	at 	at ch.qos.logback.core.joran.action.AppenderAction.end(AppenderAction.java:90)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:309)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:193)
	at 	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:179)
	at 	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:165)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:152)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:110)
	at 	at ch.qos.logback.core.joran.GenericConfigurator.doConfigure(GenericConfigurator.java:53)
	at 	at ch.qos.logback.classic.util.ContextInitializer.configureByResource(ContextInitializer.java:64)
	at 	at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:134)
	at 	at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:84)
	at 	at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:55)
	at 	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
	at 	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
	at 	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:417)
	at 	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:362)
	at 	at org.apache.commons.logging.LogAdapter$Slf4jAdapter.createLocationAwareLog(LogAdapter.java:130)
	at 	at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:91)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
	at 	at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
	at 	at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:202)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74

原因分析:

看错误感觉是logback.xml的加载顺序比spring的配置早?所以logback取不到这个属性


解决方案:

一番搜查,果然是这个原因,有人说是将logback.xml文件名修改为logback-spring.xml就可以了,试了一下可行,再去查一下logback.xml与logback-spring.xml的区别

logback和logback-spring.xml都可以用来配置logback,但是2者的加载顺序是不一样的。
logback.xml—>application.properties—>logback-spring.xml.

Spring Boot 在logback.xml中读取application.yml中配置的日志路径
logback.xml和logback-spring.xml的区别

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/IT小白/article/detail/312835
推荐阅读
相关标签
  

闽ICP备14008679号