Reputation: 3163
I'm updating Spring boot version from 2.5 to 2.6 and I encounter an issue with Logback. Here's the snippet of my application.properties file:
logging.file=abc.log
logging.path=.
And a part of my logback-spring.xml
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_PATH:-.}/${LOG_FILE}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<fileNamePattern>${LOG_PATH:-.}/${LOG_FILE}-%i.log</fileNamePattern>
<minIndex>1</minIndex>
<maxIndex>3</maxIndex>
</rollingPolicy>
<!-- Only allow a file to get to ~10MB -->
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<maxFileSize>10MB</maxFileSize>
</triggeringPolicy>
<encoder>
<pattern>%date{ISO8601} %-5level [%-35.35logger{30}] %msg%n</pattern>
</encoder>
</appender>
I'm getting the error:
2022-10-07 22:51:08,903 INFO [o.h.v.internal.util.Version ] HV000001: Hibernate Validator 6.0.22.Final
2022-10-07 22:51:09,241 INFO [o.s.c.a.ConfigurationClassParser ] Properties location [classpath:application.properties] not resolvable: class path resource [application.properties] cannot be opened because it does not exist
2022-10-07 22:51:10,158 WARN [.AnnotationConfigApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException:
I also get a file named: log_file_is_undefined.log
What am I missing?
Upvotes: 0
Views: 1080
Reputation: 6936
From the documentation:
${LOG_FILE}: Whether logging.file.name was set in Boot’s external configuration.
${LOG_PATH}: Whether logging.file.path (representing a directory for log files to live in) was set in Boot’s external configuration.
So use:
logging.file.name=abc.log
logging.file.path=.
Upvotes: 2