title: Java - Logback and Spring Boot - Only writes to Console not the File
body: <p>I'm using Logback in a Spring Boot application.  I have my configuration in logback.xml.  I'm trying to write separate log files for different processes in the application.</p>
  
  <p>In the configuration I'm creating the extra logger like the following:</p>
  
  <pre><code>&lt;!-- Each can be broken off into its own appender. --&gt;
  &lt;logger name="reportsLogger" level="info"
          additivity="false"&gt;
      &lt;appender-ref ref="REPORTS_APPENDER" /&gt;
  &lt;/logger&gt;
  &lt;root level="ERROR"&gt;
      &lt;appender-ref ref="GATEWAY_APPENDER" /&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The reports logger is created using the following appender node:</p>
  
  <pre><code>&lt;appender name="REPORTS_APPENDER"
            class="ch.qos.logback.core.rolling.RollingFileAppender"&gt;
      &lt;file&gt;${DEV_HOME}/reports.log&lt;/file&gt;
      &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
          &lt;Pattern&gt;
              %d{yyyy-MM-dd HH:mm:ss} - %msg%n
          &lt;/Pattern&gt;
      &lt;/encoder&gt;
  
      &lt;rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"&gt;
          &lt;fileNamePattern&gt;${DEV_HOME}/archived/reports.%d{yyyy-MM-dd}.%i.log
          &lt;/fileNamePattern&gt;
          &lt;timeBasedFileNamingAndTriggeringPolicy
                  class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"&gt;
              &lt;maxFileSize&gt;10MB&lt;/maxFileSize&gt;
          &lt;/timeBasedFileNamingAndTriggeringPolicy&gt;
      &lt;/rollingPolicy&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>The GATEWAY_APPENDER is defined similarly.  The DEV_HOME node is defined in the configuration as:</p>
  
  <pre><code>&lt;property name="DEV_HOME" value="c:/app-logs" /&gt;
  </code></pre>
  
  <p>When the application starts two log files are created in the DEV_HOME directory.  In the application code I'm obtaining an instance of the log as the following:</p>
  
  <pre><code>import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  
  @SpringBootApplication
  public class Application extends SpringBootServletInitializer {
  
      static Logger logger = LoggerFactory.getLogger("reportsLogger");
  
      public static void main(String[] args) {
          logger.info("*** REPORTING SERVICE STARTED ***");
          SpringApplication.run(Application.class, args);
      }
  }
  </code></pre>
  
  <p>Any ways when I try to log to the file it always writes to the console, it does not write anything to the file itself.  If I try inspecting the logger instance itself (after casting to a Logback Logger instance):</p>
  
  <pre><code>LoggerContext loggerContext = logger.getLoggerContext();
  URL mainURL = ConfigurationWatchListUtil.getMainWatchURL(loggerContext);
  </code></pre>
  
  <p>It shows me that the context of the logger is the root logger itself, and there's no file attached to it  (hence the console writing.)  What changes do I need to make to the configuration so that the information is written to the file and not to the console?</p>