Dan*_*iel 5 java logging startup logback spring-boot
启动时,Logback尝试创建/打开日志文件。但是,在当前Spring Boot的实现中,如果无法打开文件,则关闭应用程序。
如SpringBoot的git所示,这似乎是故意行为。
我更希望要么默认使用Tomcat的日志,要么完全禁用日志,但允许我的应用程序继续运行。由于我们需要将其部署在各种环境中并缩短使用寿命,因此,我宁愿不必在要部署的每个实例上自定义日志路径。
不过,我在Spring Boot或Logback设置上都没有找到任何属性,可以让我这样做。
有什么办法可以绕过IllegalStateException
?
这是启动时引发的错误:
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE-MESSAGES-BODIES] - Failed to create parent directories for [C:\MY_PATH\file.log]
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE-MESSAGES-BODIES] - openFile(C:\MY_PATH\file.log,true) call failed. java.io.FileNotFoundException: C:\MY_PATH\file.log (The device is not ready)
ERROR in ch.qos.logback.core.rolling.RollingFileAppender[FILE-LOG] - Failed to create parent directories for [C:\MY_PATH\file.log]
Run Code Online (Sandbox Code Playgroud)
使用Spring Boot(v1.5.3)
归档时间: |
|
查看次数: |
4917 次 |
最近记录: |