Skip to content

Commit 23ecb52

Browse files
committed
Reduce repetitive logging when using a cached connection
1 parent ff1ceb9 commit 23ecb52

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/io/confluent/connect/jdbc/util/CachedConnectionProvider.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,13 @@ public synchronized Connection getConnection() {
5656
log.info("The database connection is invalid. Reconnecting...");
5757
close();
5858
newConnection();
59+
} else {
60+
log.debug("Using existing database connection.");
5961
}
6062
} catch (SQLException sqle) {
6163
log.debug("Could not establish connection with database.", sqle);
6264
throw new ConnectException(sqle);
6365
}
64-
log.debug("Database connection established.");
6566
return connection;
6667
}
6768

@@ -83,6 +84,7 @@ private void newConnection() throws SQLException {
8384
log.debug("Attempting to open connection #{} to {}", count, provider);
8485
connection = provider.getConnection();
8586
onConnect(connection);
87+
log.info("Database connection established.");
8688
return;
8789
} catch (SQLException sqle) {
8890
attempts++;

0 commit comments

Comments
 (0)