Skip to content
Browse files

Better slow query log messages

  • Loading branch information...
1 parent 48dccdc commit e2171eb11f2e9144f5b6778c8647b8ff0c0edb1e @timf committed Feb 21, 2013
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/main/java/org/dasein/persist/jdbc/Loader.java
View
8 src/main/java/org/dasein/persist/jdbc/Loader.java
@@ -181,7 +181,7 @@ public void prepare(Map<String,Object> params) throws SQLException {
map.put(LISTING, list);
prepare(params);
ResultSet results = statement.executeQuery();
- long queryStartTimestamp = System.currentTimeMillis();
+ long queryStopTimestamp = System.currentTimeMillis();
try {
while( results.next() ) {
@@ -205,10 +205,10 @@ public void prepare(Map<String,Object> params) throws SQLException {
long endTimestamp = System.currentTimeMillis();
if( (endTimestamp - startTimestamp) > (2000L) ) {
- String totalTime = Long.toString((endTimestamp - startTimestamp));
- String totalQueryTime = Long.toString((endTimestamp - queryStartTimestamp));
+ String queryTime = Long.toString((queryStopTimestamp - startTimestamp));
+ String totalRsTime = Long.toString((endTimestamp - queryStopTimestamp));
- String debugTiming = "[total: "+ totalTime + ",query: " + totalQueryTime+"]";
+ String debugTiming = "[query: "+ queryTime + ",rs: " + totalRsTime+"]";
logger.warn("SLOW QUERY: " + sql + " "+ debugTiming);
}

0 comments on commit e2171eb

Please sign in to comment.
Something went wrong with that request. Please try again.