question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

LOG_FILE_IS_UNDEFINED log file is being created in boot 1.4.5

See original GitHub issue

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

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
ezraroicommented, Mar 21, 2017

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

1reaction
amounibcommented, Oct 23, 2019

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">
Read more comments on GitHub >

github_iconTop Results From Across the Web

spring boot - SpringBoot with LogBack creating ...
I get similar issue, on application start following empty file might be generated: LOG_PATH_IS_UNDEFINED; LOG_FILE_IS_UNDEFINED. Reason.
Read more >
26. Logging - Spring
Spring Boot uses Commons Logging for all internal logging but leaves the underlying log implementation open. Default configurations are provided for Java ...
Read more >
How to use Logback in Spring Boot – Rolling Files Example
Logback Rolling File Logging via Spring Boot configuration file. Basically, you just need to specify the following two lines in the application.
Read more >
Using Logback with Spring Boot - Spring Framework Guru
Spring Boot by default uses the popular logging framework logback for logging. Learn how to configure logback for Spring Boot in this post....
Read more >
Spring Boot SLF4j Logback example - Mkyong.com
2. Maven. In Spring Boot, Logback is the default logging framework, just add spring-boot-starter-web , it will pull in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found