21

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
  • 667
  • 1
  • 7
  • 17
  • See https://stackoverflow.com/questions/24448947/how-to-log-the-active-configuration-in-a-spring-boot-application – user7294900 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
  • 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

1 Answers1

38

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
  • 667
  • 1
  • 7
  • 17
  • 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
  • 1
    @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