32

i set my properties in my application.yml

spring.datasource.hikari.connection-timeout: 30000
spring.datasource.hikari.maximum-pool-size: 10
spring.datasource.hikari.idle-timeout: 600000
spring.datasource.hikari.minimum-idle: 10

Spring is 2.1.9.RELEASE

How can i log these parameter to check that the application has taken the configurations correctly?

Thank's

resla95
  • 1,017
  • 2
  • 11
  • 18
  • See https://stackoverflow.com/questions/24448947/how-to-log-the-active-configuration-in-a-spring-boot-application – Ori Marko Mar 19 '20 at 13:14
  • I need see the value into hikari class, not to environment of springboot – resla95 Mar 19 '20 at 13:33
  • logging.level.com.zaxxer.hikari.HikariConfig=DEBUG logging.level.com.zaxxer.hikari=TRACE – resla95 Mar 19 '20 at 13:52
  • 2
    I noticed that with Spring Boot 2.7.0, you need to drop the `hikari.` part in the properties names probably because Hikari is the default `DataSource` implementation. Also add `logging.level.com.zaxxer.hikari.HikariConfig=DEBUG ` and `logging.level.com.zaxxer.hikari=TRACE` if you want to verify that your properties where correctly registered. – Pierre C Jun 03 '22 at 21:10
  • It is correct, as mentioned by @PierreC, that with Spring Boot 2.7.0, you need to remove Hikari, as it will not work. Instead, you should use the properties `spring.datasource.minimumIdle` and `spring.datasource.maximum-pool-size`. It's interesting to note that IntelliJ didn't show a warning for these properties when Hikari was present, but without Hikari, it shows a "Cannot resolve config property" error. – 98percentmonkey Jun 14 '23 at 14:21

1 Answers1

61

If you have springboot and you want logging your HikariCP parameters to check that the application has taken the configurations correctly put this in your application.yaml or application.properties

logging.level.com.zaxxer.hikari.HikariConfig=DEBUG 
logging.level.com.zaxxer.hikari=TRACE

Console will show you all

resla95
  • 1,017
  • 2
  • 11
  • 18
  • 3
    Pool status gets printed every 30seconds. Is there any parameter we can use to specify this time? – Kavya Jain Jul 07 '21 at 11:27
  • 2
    @KavyaJain When you look in the `com.zaxxer.hikari.pool.HikariPool` class you'll find a housekeeper task that runs every 30s and does the logging. It seems to be undocumented and it would affect more than just logging, but you can change how often it runs with the system property `com.zaxxer.hikari.housekeeping.periodMs`, e.g. `-Dcom.zaxxer.hikari.housekeeping.periodMs=10000` to run every 10s. – Dario Seidl Oct 06 '21 at 14:08
  • The information logged can be wrong due to this spring framework bug: https://github.com/spring-projects/spring-framework/issues/29607 – wdk Nov 29 '22 at 11:58