Spring Boot logback导致/tmp磁盘爆满

Spring Boot logback 大约 1362 字

问题

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>
阅读 283 · 发布于 2020-12-10

————        END        ————

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

扫描二维码关注我
昵称:
随便看看 换一批