Don Rhummy Don Rhummy - 14 days ago 8
Java Question

How do I set the logging level for HikariCP?

Currently, HikariCP is logging at level

INFO
and I want to set it to
SEVERE
. When I try to set the level on the parent logger (the only reference to logging I can find) it throws the error:

dataSource.getParentLogger().setLevel( Level.SEVERE );


The error:

Caused by: java.sql.SQLFeatureNotSupportedException
at com.zaxxer.hikari.HikariDataSource.getParentLogger(HikariDataSource.java:176)


How do I properly set the logging level?

Answer

HikariCP uses slf4j under the hood. You will have to set the log level on your actual logger implementation (logback, log4j, JUL, ...).

Also, slf4j provides a very simple logger implementation slf4j-simple. Just add the dependency to your pom

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
    <version>1.7.5</version>
</dependency>

You can then configure it using system properties, e.g.

java -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error ...
Comments