From 18320f2e4cb9665cbfaf2877a7d7f9e072a5fe37 Mon Sep 17 00:00:00 2001 From: Brett Wooldridge Date: Fri, 17 Jul 2015 00:13:35 +0900 Subject: [PATCH] Further normalise logging. --- src/main/java/com/zaxxer/hikari/pool/HikariPool.java | 8 ++++---- src/main/java/com/zaxxer/hikari/pool/PoolElf.java | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java index dadaff3d..2677103e 100644 --- a/src/main/java/com/zaxxer/hikari/pool/HikariPool.java +++ b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java @@ -459,7 +459,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener if (connectionBag.remove(bagEntry)) { final int tc = totalConnections.decrementAndGet(); if (tc < 0) { - LOGGER.warn("Internal accounting inconsistency, totalConnections={}", tc, new Exception()); + LOGGER.warn("{} - Internal accounting inconsistency, totalConnections={}", poolName, tc, new Exception()); } closeConnectionExecutor.execute(new Runnable() { @@ -497,7 +497,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener connectionBag.add(new PoolBagEntry(connection, this)); lastConnectionFailure.set(null); - LOGGER.debug("Connection {} added to pool {} ", connection, poolName); + LOGGER.debug("{} - Connection {} added to pool", poolName, connection); return true; } @@ -505,7 +505,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener totalConnections.decrementAndGet(); // We failed, so undo speculative increment of totalConnections lastConnectionFailure.set(e); if (poolState == POOL_NORMAL) { - LOGGER.debug("Connection attempt to database in pool {} failed: {}", poolName, e.getMessage(), e); + LOGGER.debug("{} - Connection attempt to database failed", poolName, e); } poolElf.quietlyCloseConnection(connection, "(exception during connection creation)"); return false; @@ -621,7 +621,7 @@ public class HikariPool implements HikariPoolMXBean, IBagStateListener // Detect retrograde time as well as forward leaps of unacceptable duration if (now < previous || now > clockSource.plusMillis(previous, (2 * HOUSEKEEPING_PERIOD_MS))) { - LOGGER.warn("Unusual system clock change detected, soft-evicting connections from pool."); + LOGGER.warn("{} - Unusual system clock change detected, soft-evicting connections from pool.", poolName); softEvictConnections(); fillPool(); return; diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolElf.java b/src/main/java/com/zaxxer/hikari/pool/PoolElf.java index 902d5d14..93eba927 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolElf.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolElf.java @@ -85,7 +85,7 @@ public final class PoolElf return; } - LOGGER.debug("Closing connection {} in pool {} {}", connection, poolName, closureReason); + LOGGER.debug("{} - Closing connection {}: {}", poolName, connection, closureReason); try { setNetworkTimeout(connection, TimeUnit.SECONDS.toMillis(15)); } @@ -161,7 +161,7 @@ public final class PoolElf void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { - throw new SQLException("Connection.isValid() method not supported, connection test query must be configured"); + throw new SQLException("Connection.isValid() method is not supported, connection test query must be configured"); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); @@ -341,7 +341,7 @@ public final class PoolElf } catch (Throwable e) { isValidSupported = false; - LOGGER.debug("{} - Connection.isValid() not supported ({})", poolName, e.getMessage()); + LOGGER.debug("{} - Connection.isValid() not is supported ({})", poolName, e.getMessage()); } isValidChecked = true; @@ -392,7 +392,7 @@ public final class PoolElf catch (Throwable e) { if (isNetworkTimeoutSupported == UNINITIALIZED) { isNetworkTimeoutSupported = FALSE; - LOGGER.debug("{} - Connection.setNetworkTimeout() not supported ({})", poolName, e.getMessage()); + LOGGER.debug("{} - Connection.setNetworkTimeout() is not supported ({})", poolName, e.getMessage()); } } }