How to log connection pool data using BoneCP

Does anyone know that you need to log hotly the connection pool data (i.e. the number of open and idle db connections) using BoneCP? It's easy to make use of C3P0, which I'm switching from (actually, this information is logged by default there), but it seems harder to get BoneCP singing. Currently, what I see in the logs is raw SQL queries.

+5
source share
1 answer

Use the Statistics class. For example: ... configure a BoneCP connectionPool object

Statistics stats = connectionPool.getStatistics() (previously getStats but later renamed)
return
"Tot Conn Created:   " + stats.getTotalCreatedConnections() +
"Tot Free Conn:      " + stats.getTotalFree() +
"Tot Leased Conn:    " + stats.getTotalLeased();
+5
source

All Articles