title: Configure logback using several profiles
body: <p>I´m trying to split my logback.xml by profiles under springboot, this my approach:</p>
  
  <p><strong>logback-prod.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  &lt;include resource="org/springframework/boot/logging/logback/defaults.xml" /&gt;
  &lt;property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:- ${java.io.tmpdir:-/tmp}}/}spring.log}"/&gt;
  &lt;include resource="org/springframework/boot/logging/logback/file- appender.xml" /&gt;
  
  &lt;root level="INFO"&gt;
      &lt;appender-ref ref="CONSOLE" /&gt;
  &lt;/root&gt;
  &lt;/configuration&gt; 
  </code></pre>
  
  <p><strong>logback-dev.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  &lt;include resource="org/springframework/boot/logging/logback/defaults.xml" /&gt;
  &lt;include resource="org/springframework/boot/logging/logback/console-appender.xml" /&gt;
  
  &lt;root level="DEBUG"&gt;
      &lt;appender-ref ref="CONSOLE" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>logback.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
  &lt;include resource="logback-${spring.profiles.active}.xml"/&gt;
  
  &lt;root level="INFO"&gt;
      &lt;appender-ref ref="FILE" /&gt;
      &lt;appender-ref ref="CONSOLE" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p></p>
  
  <p>And finally use: </p>
  
  <pre><code>-Dspring.profiles.active=dev
   or
  -Dspring.profiles.active=prod
  </code></pre>
  
  <p>I got in console:</p>
  
  <pre><code>13:01:44,673 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@2:16 - no  applicable action for [configuration], current ElementPath  is [[configuration][configuration]]
  13:01:44,674 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@3:81 - no applicable action for [include], current ElementPath  is [[configuration][configuration][include]]
  13:01:44,674 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@4:89 - no applicable action for [include], current ElementPath  is [[configuration][configuration][include]]
  13:01:44,674 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@6:25 - no applicable action for [root], current ElementPath  is [[configuration][configuration][root]]
  13:01:44,674 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@7:39 - no applicable action for [appender-ref], current ElementPath  is [[configuration][configuration][root][appender-ref]]
  13:01:44,675 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
  </code></pre>