title: Understanding Spring Boot 2's default logback configuration
body: <p>I'm creating a Java Spring Boot 2.1 application that uses Maven to add the spring-boot-starter dependency. As written in <a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-logging" rel="nofollow noreferrer">the documentation</a>, this enables the default logback configuration. This configuration can be found freely <a href="https://github.com/spring-projects/spring-boot/tree/master/spring-boot-project/spring-boot/src/main/resources/org/springframework/boot/logging/logback" rel="nofollow noreferrer">in this repository</a> and contains syntax that is a bit difficult for me to understand.</p>
  <p><strong>1. The mysterious dash</strong></p>
  <p>I know Spring properties are set by using the following syntax</p>
  <blockquote>
  <p>${property.name:someDefaultValue}</p>
  </blockquote>
  <p>However, in the xml files for the logback configuration, there is always a dash right after the colon. Why is this? for example:</p>
  <blockquote>
  <p>&lt;property name=&quot;LOG_FILE&quot; value=&quot;${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}/&gt;&quot;</p>
  </blockquote>
  <p><strong>2. The changing property names</strong></p>
  <p>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:</p>
  <blockquote>
  <p>logging.file = /app/logs/mylog.log</p>
  </blockquote>
  <p>How and where is the property with name <code>logging.file</code> translated to the property with name <code>LOG_FILE</code> as used in the logback xml file?</p>
  <p><strong>3. The missing property</strong></p>
  <p>Specifically this property has no equivalent property in application.properties (or .yml) to configure it</p>
  <blockquote>
  <p>&lt;totalSizeCap&gt;${LOG_FILE_TOTAL_SIZE_CAP:-0} &lt;/totalSizeCap&gt;</p>
  </blockquote>
  <p>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?</p>
  <p><strong>4. We're stuck with the default appenders</strong></p>
  <p>The only appender logic in the logback xml files is:</p>
  <blockquote>
  <p>&lt;root level=&quot;INFO&quot;&gt;</p>
  <p>&lt;appender-ref ref=&quot;CONSOLE&quot;/&gt;</p>
  <p>&lt;appender-ref ref=&quot;FILE&quot;/&gt;</p>
  <p>&lt;/root&gt;</p>
  </blockquote>
  <p>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 &quot;merge&quot; them, or simply pick one and ignore the others? How does overwriting/merging work, which xml 'wins'?</p>