title: How to write all log output to file spring boot
body: <p>I'm using logback-spring.xml in a spring boot project.  I want to log all uncaught exceptions to a file.  Basically just direct the output from the console to a file.  I've tried several variations of logback-spring.xml.  </p>
  
  <p>I tried this</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
      &lt;include resource="org/springframework/boot/logging/logback/base.xml" /&gt;
      &lt;logger name="com.mine" level="WARN" additivity="false"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="FILE" /&gt;
      &lt;/logger&gt;
  
      &lt;root level="INFO"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
          &lt;appender-ref ref="FILE"&gt;
              &lt;contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator"&gt;
                  &lt;resetJUL&gt;true&lt;/resetJUL&gt;
              &lt;/contextListener&gt;
          &lt;/appender-ref&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>with this in my main method <code>SLF4JBridgeHandler.install();</code></p>
  
  <p>I've tried this from the spring docs</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="FILE" /&gt;
      &lt;/root&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>this is in my application.yml</p>
  
  <pre><code>logging:
    file: C:\dev\assessment-tool\logs\application.log
    config: classpath:logback-spring.xml
  </code></pre>
  
  <p>For these it will log all the start up logging messages but when an exception is thrown and not caught it goes to the console and doesn't show up in the log file.  How can I make uncaught exceptions go to a log file?</p>