I'm creating a Java Spring Boot 2.1 application that uses Maven to add the spring-boot-starter dependency. As written in the documentation, this enables the default logback configuration. This configuration can be found freely in this repository and contains syntax that is a bit difficult for me to understand.
1. The mysterious dash
I know Spring properties are set by using the following syntax
${property.name:someDefaultValue}
However, in the xml files for the logback configuration, there is always a dash right after the colon. Why is this? for example:
<property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}/>"
2. The changing property names
It is also unclear to me where all these property names are coming from. In the documentation it is mentioned to fill our application.properties or application.yml with properties such as:
logging.file = /app/logs/mylog.log
How and where is the property with name logging.file
translated to the property with name LOG_FILE
as used in the logback xml file?
3. The missing property
Specifically this property has no equivalent property in application.properties (or .yml) to configure it
<totalSizeCap>${LOG_FILE_TOTAL_SIZE_CAP:-0} </totalSizeCap>
If I want to change this property to some other value, I'd have to somehow set the LOG_FILE_TOTAL_SIZE_CAP property. How can I do this while still using the original default logback configuration xml provided by spring boot?
4. We're stuck with the default appenders
The only appender logic in the logback xml files is:
<root level="INFO">
<appender-ref ref="CONSOLE"/>
<appender-ref ref="FILE"/>
</root>
And the application.properties allow no way to change this. Although I must admit this is very useful default, it sometimes doesn't work. It seems like overkill to have to completely overwrite the entire logback xml configuration for one small tweak to an appender or policy. If I were to provide multiple custom logback/xml configuration files on my classpath, would logback "merge" them, or simply pick one and ignore the others? How does overwriting/merging work, which xml 'wins'?