简体   繁体   English

如何使用BoneCP记录连接池数据

[英]How to log connection pool data using BoneCP

Does anyone know hot to log connection pool data (ie number of open and idle db connections) using BoneCP? 有谁知道使用BoneCP记录连接池数据(即打开和空闲的数据库连接数)很热? It's easy to achieve using C3P0 which I'm migrating from (in fact this information is logged by default there) but it seems to be harder to get sing BoneCP. 使用我要从中进行迁移的C3P0可以很容易地实现(实际上,此信息默认情况下记录在此),但是似乎很难使用BoneCP。 For now what I see in logs is raw SQL statements. 现在,我在日志中看到的是原始SQL语句。

Use the Statistics class. 使用统计信息类。 For example: ...set up BoneCP connectionPool object 例如:...设置BoneCP connectionPool对象

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();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM