Today I find an issue when running a Spring Boot web application: the web app generates logging files at the “/tmp” directory which consumes a lot of storage. I didn’t set this. Why?
Now it’s clear: “base.xml” contains a file appender which will write log to the “/tmp” directory. So I update my “logback.xml” file, replace the “base.xml” file with the “defaults.xml” file:
1 2 3 4 5 6 7 8 9
<includeresource="org/springframework/boot/logging/logback/defaults.xml"/> <includeresource="org/springframework/boot/logging/logback/console-appender.xml" /> <appendername="FILE"class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- This is the file appender I defined. --> </appender> <rootlevel="INFO"> <appender-refref="CONSOLE" /> <appender-refref="FILE"/> </root>
Note that I still keep the console appender defined by Sprint Boot, since I still want to keep the logging console output.