title: Spring boot logging into multiple files
body: <p>Is there any way I can configure spring boot logging to multiple files/console based on the configuration? i.e Some of the log statements should write into an audit file and normal log statements should go to console/normal log file.</p>
  
  <p>Below is the code I have tried on spring boot example application.</p>
  
  <p>logback-spring.xml</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="file" level="DEBUG" additivity="false"&gt;
          &lt;appender-ref ref="FILE" /&gt;
      &lt;/logger&gt;
      &lt;logger name="org.hello" level="ERROR" additivity="false"&gt;
          &lt;appender-ref ref="CONSOLE" /&gt;
      &lt;/logger&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Below is the application.properties entries</p>
  
  <pre><code>logging.level.org.springframework.web=INFO
  logging.file=logs/spring-boot-logging.log
  </code></pre>
  
  <p>Below the   HelloController</p>
  
  <pre><code>@RestController
  public class HelloController {
  
  Logger logger = LoggerFactory.getLogger(HelloController.class);
  
      Logger logger1 = LoggerFactory.getLogger("file");
  
      @RequestMapping("/")
      public String index() {
  
          logger.info("My Log test");
          logger1.info("My Audit test");
  
  
          return "Greetings from Spring Boot!";
      }
  
  }
  </code></pre>
  
  <p>Can someone please help? Did anyone face similar situation? </p>
  
  <p>Thanks a lot</p>