Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/tmp/spring.log file is generating on spring boot service startup e #12538

Closed
manjunadh opened this issue Mar 19, 2018 · 5 comments
Closed

/tmp/spring.log file is generating on spring boot service startup e #12538

manjunadh opened this issue Mar 19, 2018 · 5 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@manjunadh
Copy link

manjunadh commented Mar 19, 2018

Hi,
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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 19, 2018
@wilkinsona
Copy link
Member

It's difficult to suggest a fix when we can't see everything. Can you please provide a minimal, complete, and verifiable example of the behaviour that you have described?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Mar 19, 2018
@manjunadh
Copy link
Author

you can replicate with below project

https://github.com/manjunadh/config-server

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Mar 20, 2018
@wilkinsona
Copy link
Member

Thanks for the sample. Your logback-spring.xml is including org/springframework/boot/logging/logback/base.xml. That, in turn, includes Boot's default file appender configuration which writes to /tmp/spring.log by default.

@wilkinsona wilkinsona added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged labels Mar 20, 2018
@manjunadh
Copy link
Author

please suggest the replacement for org/springframework/boot/logging/logback/base.xml in logback-spring.xml

@wilkinsona
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants