title: Spring Boot logback-spring.xml not logging application logs
body: <p>I use spring boot 2.3.1 version, and I have an issue with application logs. My logback-spring.xml file as below,</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;appender name=&quot;CONSOLE&quot; class=&quot;ch.qos.logback.core.ConsoleAppender&quot;&gt;
          &lt;encoder&gt;
              &lt;pattern&gt;%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ} [%thread] %-5level %logger{5} - %msg%n&lt;/pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
      &lt;appender name=&quot;APP_LOGGER&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
          &lt;file&gt;/var/log/app.log&lt;/file&gt;
          &lt;rollingPolicy class=&quot;ch.qos.logback.core.rolling.TimeBasedRollingPolicy&quot;&gt;
              &lt;fileNamePattern&gt;/var/log/app.%d{yyyy-MM-dd}.log&lt;/fileNamePattern&gt;
              &lt;maxHistory&gt;15&lt;/maxHistory&gt;
          &lt;/rollingPolicy&gt;
          &lt;encoder&gt;
              &lt;Pattern&gt;%d{yyyy-MM-dd'T'HH:mm:ss.SSSZZ} %-5level %-12X{process} %-30([%thread]) %-29logger - %m%n&lt;/Pattern&gt;
          &lt;/encoder&gt;
      &lt;/appender&gt;
      &lt;logger name=&quot;com.sample&quot; level=&quot;DEBUG&quot; additivity=&quot;false&quot;/&gt;
      &lt;logger name=&quot;org.springframework&quot; level=&quot;INFO&quot;/&gt;
  
      &lt;root level=&quot;DEBUG&quot;&gt;
          &lt;appender-ref ref=&quot;CONSOLE&quot;/&gt;
          &lt;appender-ref ref=&quot;APP_LOGGER&quot;/&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>My controller is,</p>
  <pre><code>package com.sample;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.web.bind.annotation.GetMapping;
  
  @RestController
  public class Controller {
  
    private static final Logger LOGGER = LoggerFactory.getLogger(Controller.class);
  
    @GetMapping(&quot;/&quot;)
    public void greetings(){
      LOGGER.info(&quot;AAAAA....&quot;);
      LOGGER.debug(&quot;DDDD...&quot;);
      LOGGER.warn(&quot;WWW...&quot;);
      LOGGER.error(&quot;EEEE....&quot;)
    }
  
  }
  </code></pre>
  <p>I tried adding the below in application.properties file,</p>
  <pre><code>logging.level.root=DEBUG
  logging.level.org.springframework=INFO
  logging.level.com.sample=DEBUG
  </code></pre>
  <p>no luck, and also tried with other alternative approach as below, and added file path <code>logging.file.name=/var/log/app.log</code> in <code>application.properties</code>.</p>
  <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;configuration&gt;
      &lt;include resource=&quot;org/springframework/boot/logging/logback/defaults.xml&quot; /&gt;
      &lt;property name=&quot;LOG_FILE&quot; value=&quot;${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}/}spring.log}&quot;/&gt;
      &lt;include resource=&quot;org/springframework/boot/logging/logback/console-appender.xml&quot; /&gt;
      &lt;include resource=&quot;org/springframework/boot/logging/logback/file-appender.xml&quot; /&gt;
      
      &lt;logger name=&quot;org.springframework.web&quot; level=&quot;INFO&quot;/&gt;
      &lt;logger name=&quot;com.sample&quot; level=&quot;DEBUG&quot;/&gt;
  
      &lt;root level=&quot;DEBUG&quot;&gt;
          &lt;appender-ref ref=&quot;CONSOLE&quot; /&gt;
          &lt;appender-ref ref=&quot;FILE&quot; /&gt;
      &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  <p>app.log file is creating and I see only spring related logs, not application logs in the app.log file.</p>