Skip to content

Commit 072bc6e

Browse files
committed
#18 - ENH: Additionally log the SQLException message in DataSourceInitialiseException
1 parent b5b0b37 commit 072bc6e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/main/java/io/ebean/datasource/pool/ConnectionPool.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private void initialise() throws SQLException {
303303
if (failOnStart) {
304304
throw e;
305305
}
306-
logger.error("Error trying to ensure minimum connections. Maybe db server is down.", e);
306+
logger.error("Error trying to ensure minimum connections, maybe db server is down - message:" + e.getMessage(), e);
307307
}
308308
}
309309

@@ -326,7 +326,7 @@ private void initialiseDatabase() throws SQLException {
326326
initDatabase.run(ownerConnection, config);
327327
ownerConnection.commit();
328328
} catch (SQLException e2) {
329-
throw new SQLException("Failed to run InitDatabase with ownerUsername:" + config.getOwnerUsername(), e2);
329+
throw new SQLException("Failed to run InitDatabase with ownerUsername:" + config.getOwnerUsername() + " message:" + e2.getMessage(), e2);
330330
}
331331
}
332332
}
@@ -403,7 +403,7 @@ private synchronized void notifyDataSourceIsDown(SQLException ex) {
403403
}
404404
if (!dataSourceDownAlertSent) {
405405
dataSourceDownAlertSent = true;
406-
logger.error("FATAL: DataSourcePool [" + name + "] is down or has network error!!!", ex);
406+
logger.error("FATAL: DataSourcePool [" + name + "] is down or has network error!!! message:" + ex.getMessage(), ex);
407407
if (notify != null) {
408408
notify.dataSourceDown(this, ex);
409409
}
@@ -441,7 +441,7 @@ private void trimIdleConnections() {
441441
queue.trim(maxInactiveMillis, maxAgeMillis);
442442
lastTrimTime = System.currentTimeMillis();
443443
} catch (Exception e) {
444-
logger.error("Error trying to trim idle connections", e);
444+
logger.error("Error trying to trim idle connections - message:" + e.getMessage(), e);
445445
}
446446
}
447447
}
@@ -640,14 +640,14 @@ private boolean testConnection(Connection conn) throws SQLException {
640640
rset.close();
641641
}
642642
} catch (SQLException e) {
643-
logger.error(null, e);
643+
logger.error("Error closing resultSet", e);
644644
}
645645
try {
646646
if (stmt != null) {
647647
stmt.close();
648648
}
649649
} catch (SQLException e) {
650-
logger.error(null, e);
650+
logger.error("Error closing statement", e);
651651
}
652652
}
653653
}
@@ -661,7 +661,7 @@ boolean validateConnection(PooledConnection conn) {
661661
return testConnection(conn);
662662

663663
} catch (Exception e) {
664-
logger.warn("heartbeatsql test failed on connection[" + conn.getName() + "]");
664+
logger.warn("heartbeatsql test failed on connection:" + conn.getName() + " message:" + e.getMessage());
665665
return false;
666666
}
667667
}

0 commit comments

Comments
 (0)