title: Change HikariCP Logging file
body: <p>I am currently using Sl4j 1.7.25 with logback-classic-1.2.3</p>
  
  <p>The logback.xml put inside the class path of the tomcat i.e WEB-INF/classes is as follows:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE xml&gt;
  &lt;configuration&gt;
  
    &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
      &lt;file&gt;${catalina.home}/logs/foodini.log&lt;/file&gt;
      &lt;append&gt;true&lt;/append&gt;
      &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
        &lt;Pattern&gt;[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%logger] [%-5level] - %msg%n&lt;/Pattern&gt;
      &lt;/encoder&gt;
    &lt;/appender&gt;
  
  
    &lt;root level="ALL"&gt;
      &lt;appender-ref ref="FILE" /&gt;
    &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>This works fine and everything gets logged inside the foodini.log file under tomcat logs directory.</p>
  
  <p>Now unfortunately, HikariCp also logs to the same file and constantly at an interval of around 30 seconds. It basically writes pool events and leaks and all. I need this to go in a separate file say hikari.log rather than inside foodini.log which is meant to be the logs of just my webapp to avoid clutter.</p>
  
  <p>I tried :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE xml&gt;
  &lt;configuration&gt;
  
    &lt;appender name="FILE" class="ch.qos.logback.core.FileAppender"&gt;
      &lt;file&gt;${catalina.home}/logs/foodini.log&lt;/file&gt;
      &lt;append&gt;true&lt;/append&gt;
      &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
        &lt;Pattern&gt;[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%logger] [%-5level] - %msg%n&lt;/Pattern&gt;
      &lt;/encoder&gt;
    &lt;/appender&gt;
  
  
    &lt;appender name="HIKARI" class="ch.qos.logback.core.FileAppender"&gt;
      &lt;file&gt;${catalina.home}/logs/hikari.log&lt;/file&gt;
      &lt;append&gt;true&lt;/append&gt;
      &lt;encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder"&gt;
        &lt;Pattern&gt;[%d{dd-MMM-yyyy HH:mm:ss.SSS}] [%logger] [%-5level] - %msg%n&lt;/Pattern&gt;
      &lt;/encoder&gt;
    &lt;/appender&gt;
  
    &lt;logger name="com.zaxxer.hikari"&gt;
      &lt;appender-ref ref="HIKARI" /&gt;
    &lt;/logger&gt;
  
    &lt;root level="ALL"&gt;
      &lt;appender-ref ref="FILE" /&gt;
    &lt;/root&gt;
  
  &lt;/configuration&gt;
  </code></pre>
  
  <p>It does create a new file called hikari.log but all things still get logged inside foodini.log</p>
  
  <p>For any one servlet i use :</p>
  
  <pre><code>private static final Logger LOG = LoggerFactory.getLogger(ServeletName.class);
  </code></pre>
  
  <p>to get the logger and it works fine.</p>
  
  <p>EDIT: added a logger configuration to the logback file and now logs go to both the files foodini.log and hikari.log... Now i need the hikari logs from going in foodini.log file at all</p>