Disable HikariPool logging

后端 未结 4 709
被撕碎了的回忆
被撕碎了的回忆 2021-02-18 19:20

This is perhaps a very simple question. How do i disable Hikari-CP debug logs? In my log file i have lots of these messages

DEBUG [.zaxxer.hikari.pool.HikariPool         


        
4条回答
  •  不思量自难忘°
    2021-02-18 20:01

    You can set the levels of Hikari loggers dynamically:

    import org.apache.log4j.Logger;
    import org.apache.log4j.Level;
    
    public class App{
         public static main(String[] args) {
             Logger.getLogger("com.zaxxer.hikari.pool.PoolBase").setLevel(Level.OFF);
             Logger.getLogger("com.zaxxer.hikari.pool.HikariPool").setLevel(Level.OFF);
             Logger.getLogger("com.zaxxer.hikari.HikariDataSource").setLevel(Level.OFF);
             Logger.getLogger("com.zaxxer.hikari.HikariConfig").setLevel(Level.OFF);
             Logger.getLogger("com.zaxxer.hikari.util.DriverDataSource").setLevel(Level.OFF);
         }
    }
    

    I have tested this on hikariCP 3.4.1 with log4j 1.2.17

提交回复
热议问题