support logStats

This commit is contained in:
wenshao
2013-05-19 17:13:45 +08:00
parent e21b08262b
commit 9a892241ea
9 changed files with 203 additions and 61 deletions
@@ -82,6 +82,7 @@ import com.alibaba.druid.util.JdbcUtils;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.druid.wall.WallFilter;
;
/**
* @author ljw<ljw2083@alibaba-inc.com>
* @author wenshao<szujobs@hotmail.com>
@@ -176,14 +177,23 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
{
String property = System.getProperty("druid.filters");
if (property == null || property.length() == 0) {
return;
if (property != null && property.length() > 0) {
try {
this.setFilters(property);
} catch (SQLException e) {
LOG.error("setFilters error", e);
}
}
try {
this.setFilters(property);
} catch (SQLException e) {
LOG.error("setFilters error", e);
}
{
String property = System.getProperty("druid.timeBetweenLogStatsMillis");
if (property != null && property.length() > 0) {
try {
long value = Long.parseLong(property);
this.setTimeBetweenLogStatsMillis(value);
} catch (NumberFormatException e) {
LOG.error("illegal property 'timeBetweenLogStatsMillis'", e);
}
}
}
}
@@ -1336,9 +1346,9 @@ public class DruidDataSource extends DruidAbstractDataSource implements DruidDat
if (statLogger == null) {
return;
}
DruidDataSourceStatValue statValue = getStatValueAndReset();
statLogger.log(statValue);
}