如何启用HikariCP调试日志记录

时间:2019-04-25 13:01:28

标签: hikaricp

我正在将Hikari CP的版本3.3.1与Java版本1.8一起使用。尝试使用其他版本,但没有区别

在我的logback.xml中添加:

<logger name="com.zaxxer.hikari.HikariConfig" level="debug">
        <appender-ref ref="FILE-AUDIT-HIKARI" />
        <appender-ref ref="STDOUT" />
</logger>

注意:我确实定义了两个追加器,并且似乎从这里获取的唯一日志是启动应用程序并将它们粘贴到下面的时候:

我希望它能给我调试日志,特别是与leakDetectionThreshold

相关的日志

在我的应用程序启动时,我得到了:

2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - Driver class com.mysql.cj.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader@18b4aac2
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - MySQLConnectionPool - configuration:
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................true
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - catalog.........................none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............30000
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{autoReconnect=true, password=<masked>}
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................."com.mysql.cj.jdbc.Driver"
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................600000
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailFast..........true
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - jdbc4ConnectionTest.............false
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:mysql://localhost:3306/push_notifications
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold..........2000
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime.....................1800000
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize.................40
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry..................com.codahale.metrics.MetricRegistry@fde2787
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory...........none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle.....................40
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - password........................<masked>
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - poolName........................"MySQLConnectionPool"
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - readOnly........................false
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans..................false
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor...............none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutorService........internal
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - schema..........................none
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory...................internal
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation............default
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - username........................"root"
2019-04-25 18:26:13 [pool-1-thread-17] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout...............5000

,此后什么也没有。

在pom.xml中具有与日志相关的jars

<dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.2.3</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.25</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>log4j-over-slf4j</artifactId>
            <version>1.7.25</version>
        </dependency>

        <dependency>
            <groupId>io.dropwizard.metrics</groupId>
            <artifactId>metrics-logback</artifactId>
            <version>3.1.0</version>
        </dependency>

0 个答案:

没有答案