Spring Boot logback 导致 /tmp 磁盘爆满
Spring Boot logback About 1,363 words问题
logback.xml
中引入了base.xml
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<property name="logPath" value="${user.dir}/logs"/>
<!-- 省略 -->
</configuration>
从base.xml
相关源码可得知:将输出一份到/tmp
目录下,名为spring.log
的文件中。
<?xml version="1.0" encoding="UTF-8"?>
<!--
Base logback configuration provided for compatibility with Spring Boot 1.1
-->
<included>
<include resource="org/springframework/boot/logging/logback/defaults.xml" />
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/>
<include resource="org/springframework/boot/logging/logback/console-appender.xml" />
<include resource="org/springframework/boot/logging/logback/file-appender.xml" />
<root level="INFO">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</root>
</included>
解决
将base.xml
改为defaults.xml
。
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
<property name="logPath" value="${user.dir}/logs"/>
<!-- 省略 -->
</configuration>
Views: 5,167 · Posted: 2020-12-10
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb/LiteNote扫描下方二维码关注公众号和小程序↓↓↓
Loading...