SpringBoot
LogBack
LOG_PATH_IS_UNDEFINED
Logging
Java Configuration

SpringBoot with LogBack creating LOG_PATH_IS_UNDEFINED folder

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

If Spring Boot with Logback creates a folder named LOG_PATH_IS_UNDEFINED, it usually means your Logback configuration expects a log-path property that was never actually set. Logback then resolves the missing property to the literal fallback token and happily creates that directory.

This is not really a Logback bug. It is almost always a configuration mismatch between your logback.xml or logback-spring.xml file and the Spring Boot logging properties you thought were available.

Why the Folder Appears

A common Logback pattern looks like this:

xml
<property name="LOG_PATH" value="${LOG_PATH}"/>

If LOG_PATH does not exist in the environment or in Spring's resolved property sources at the time Logback parses the file, appenders that use ${LOG_PATH} may end up writing into a directory literally named LOG_PATH_IS_UNDEFINED.

That is the symptom telling you: the path variable was not resolved.

Use Spring-Aware Configuration When Needed

If you want to use Spring Boot properties such as values from application.properties or application.yml, prefer logback-spring.xml over plain logback.xml.

Example application.yml:

yaml
logging:
  file:
    path: /var/log/myapp

Example logback-spring.xml:

xml
1<configuration>
2    <springProperty scope="context" name="LOG_PATH" source="logging.file.path"/>
3
4    <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
5        <file>${LOG_PATH}/app.log</file>
6        <encoder>
7            <pattern>%d %-5level %logger - %msg%n</pattern>
8        </encoder>
9    </appender>
10
11    <root level="INFO">
12        <appender-ref ref="FILE"/>
13    </root>
14</configuration>

This works because logback-spring.xml understands Spring-specific extensions such as <springProperty>.

Plain logback.xml Has Fewer Options

If you use plain logback.xml, Spring Boot property resolution is more limited. That often leads people to think logging.file.path will magically populate a variable that Logback can read directly in every context.

It is safer to either:

  • use logback-spring.xml with Spring-aware property binding, or
  • define the required environment variable explicitly before startup

For example:

bash
export LOG_PATH=/var/log/myapp
java -jar app.jar

Verify the Property Name

Another common issue is mixing old and new property names. Depending on the Spring Boot version, examples on the internet may reference different logging properties, and copying them blindly causes confusion.

When the folder LOG_PATH_IS_UNDEFINED appears, inspect both sides:

  • the property name you set in Spring Boot config
  • the variable name Logback is actually trying to read

They often do not match.

Check the Working Directory Too

If the placeholder resolves badly and no absolute path is configured, the odd directory may appear under whatever working directory the application started from. That is why the folder sometimes shows up next to the JAR, inside a container work directory, or under an IDE project root instead of somewhere obviously "logging related."

Add a Safe Default if Appropriate

If the log path is optional in some environments, give it an explicit fallback rather than letting Logback invent one.

xml
<property name="LOG_PATH" value="${LOG_PATH:-./logs}"/>

Or with Spring-aware config, provide a property that is always set per environment. The important thing is to choose the default on purpose instead of accepting an undefined placeholder.

Common Pitfalls

  • Using logback.xml while expecting Spring Boot properties to behave like logback-spring.xml.
  • Referring to LOG_PATH in Logback without ever defining that variable.
  • Mixing property names from different Spring Boot versions or examples.
  • Assuming the strange directory name is a filesystem bug instead of a missing-property clue.
  • Omitting a sensible fallback path for environments where log-path configuration is optional.

Summary

  • 'LOG_PATH_IS_UNDEFINED usually means Logback expected a path property that was never resolved.'
  • Use logback-spring.xml if you want to bind values cleanly from Spring Boot configuration.
  • Check that the property name in Boot config matches the variable name Logback expects.
  • Provide an intentional default path when appropriate.
  • Treat the folder name as a configuration diagnostic, not as random Logback behavior.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.