Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is_undefined directory error in logack with Spring Boot application

I am getting log.dir_IS_UNDEFINED error even though I'm passing log.dir as a java parameter -Dlog.dir="/logs"

Here is a snippet of my logback.xml file

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.dir}/crm.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
like image 327
Deepak Parmar Avatar asked Nov 10 '22 02:11

Deepak Parmar


1 Answers

I suggest to switch to Spring Boot logging support. Take a look at configuration section of Spring Boot docs

You can use this:

# LOGGING
logging.path=/var/log
logging.file=myapp.log

Or you can define it also via system properties:

-Dlogging.path=/var/log -Dlogging.file=myapp.log

According this section of Spring Boot Docs about logging with Logback, you can also use ${LOG_FILE} and ${LOG_PATH} environment variables.

like image 54
luboskrnac Avatar answered Jan 04 '23 03:01

luboskrnac