spring-boot: LOG_FILE_IS_UNDEFINED log file is being created in boot 1.4.5

when using vanila Spring boot 1.4.5 with the following logback configuration:

<configuration>
  <appender name="FILE" class="ch.qos.logback.core.FileAppender">
    <file>${LOG_FILE}</file>
    <encoder>
      <pattern>%logger{35} - %msg%n</pattern>
    </encoder>
  </appender>

  <appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
    <appender-ref ref="FILE" />
  </appender>

  <root level="INFO">
    <appender-ref ref="ASYNC" />
  </root>
</configuration>

and the following application.properties:

logging.file=/tmp/myapp.log

Empty file is being created in the name of LOG_FILE_IS_UNDEFINED. Looks like 2 async appenders are being created, one with LOG_FILE_IS_UNDEFINED as the file name and another one with the file name from the properties. The LOG_FILE_IS_UNDEFINED is stopped immediately and this is why the file is empty.

@regevbr

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (3 by maintainers)

Most upvoted comments

Hi, after changing the file to logback-spring.xml it is working fine! thanks

So, for us, we need the spring cloud components. Found that adding <include resource="org/springframework/boot/logging/logback/base.xml" /> right after the configuration tag at the top resolves the erroneous file generation

So our file starts

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/base.xml" />
    <appender name="JSON" class="ch.qos.logback.core.rolling.RollingFileAppender">