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
I use log4j properties, simple add these two lines:
log4j.category.com.zaxxer.hikari=INFO
log4j.logger.HikariPool=INFO
The class name is displaying in you DEBUG info: DEBUG [.zaxxer.hikari.pool.HikariPool:] - ... here the class name is zaxxer.hikari.pool.HikariPool, Just modify config file as being disaplayed.
I use logback logger, there is a file named logback.xml located in resources folder, to disable HikariPool logging, i write following config:
<configuration>
...
<logger name="com.zaxxer.hikari.pool.PoolBase" level="ERROR"/>
<logger name="com.zaxxer.hikari.pool.HikariPool" level="ERROR"/>
<logger name="com.zaxxer.hikari.HikariDataSource" level="ERROR"/>
</configuration>
The logger name should be com.zaxxer.hikari
not org.zaxxer.hikari
.
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