In spring-boot
application, I am trying to config a default dir for logback
.
Usually, in logback.xml
I would config it this way:
<property name="logFile.dir" value="${catalina.home:-/tmp}/logs" />
The separator is :-
.
But, in application.properties
:
I have to config it this way:
logging.file=${catalina.home:/tmp}/logs/sportslight.log
Need to change the separator from :-
to :
.
The questions are:
logback.xml
, which is the correct separator, :-
or :
?application.properties
, why only :
works, is it because spring-boot would handle it first before pass the value to logback? In logback.xml the correct separator is :-
. More details in the logback docs.
In Spring the correct separator is :
since Spring supports the ${my.property:defaultValue}
syntax. More details in the PlaceholderConfigurerSupport doc.
So, when faced with a choice of default value separator for variable substitution the logback author(s) chose :-
and the Spring author(s) chose :
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With