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,069 · Posted: 2020-12-10

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh