/tmp/spring.log file is generating on spring boot service startup e
See original GitHub issueHi, I am using spring boot 1.59 version.
I have logback-spring.xml
with proper configurations still spring boot application is generating /tmp/spring.log
file on application start up.
Below are my logback-spring.xml
configurations.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<jmxConfigurator/>
<property name="CONSOLE_LOG_PATTERN"
value="%d{MM/dd/yyyy HH:mm:ss.SSS XXX} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } -- [%thread] %logger{60} : %msg%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}"/>
<!-- Appender to log to file -->
<springProfile name="local,bamboo">
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>logs/service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>logs/service.%d{yyyy-MM-dd}_%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 10MB -->
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 7 days' worth of history -->
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<root >
<appender-ref ref="file" level="INFO" />
</root>
</springProfile>
<springProfile name="development,qa1,qa4,pp,prod">
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/apps/services/logs/inventory/service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>/apps/services/logs/inventory/service.%d{yyyy-MM-dd}_%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 10MB -->
<maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 7 days' worth of history -->
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>utf8</charset>
</encoder>
</appender>
<root >
<appender-ref ref="file" level="INFO" />
</root>
</springProfile>
</configuration>
Please suggest some fix
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Spring Boot uses /tmp/spring.log file during testing
In my Spring Boot application, I have added <property name="LOG_TEMP" value="./logs"/> to src/test/resources/logback-test.xml :
Read more >Logging in Spring Boot - Baeldung
Learn which beans are automatically configured in your Spring Boot application by generating an auto-configuration report during startup.
Read more >Spring Boot Reference Documentation
Try the How-to documents. They provide solutions to the most common questions. Learn the Spring basics. Spring Boot builds on many other Spring...
Read more >Configuring Logging - Quarkus
Internally, Quarkus uses JBoss Log Manager and the JBoss Logging facade. You can use the JBoss ... An example is shown in File...
Read more >Disable Logback log files in containers - Mobabel
The root cause is spring logback is writing log files into /tmp/ directory as “”spring.log in the containers and the log files are...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the sample. Your
logback-spring.xml
is includingorg/springframework/boot/logging/logback/base.xml
. That, in turn, includes Boot’s default file appender configuration which writes to/tmp/spring.log
by default.The replacement should be whatever is appropriate for how you want your logging to be configured and that doesn’t include a file appender that logs to
/tmp/spring.log
by default. Only you can know what that is and only you know what your requirements are.