changeset 1120:d387a97807a3

Added an INFO log statement displaying the execution time of a database query. geo-backend/trunk@1137 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 31 May 2010 07:23:21 +0000
parents 1e003d3b06e8
children 9d530f913729
files geo-backend/ChangeLog geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/geo-backend/ChangeLog	Wed Apr 28 15:10:11 2010 +0000
+++ b/geo-backend/ChangeLog	Mon May 31 07:23:21 2010 +0000
@@ -1,3 +1,8 @@
+2010-05-31  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java:
+	  Show the execution time of a database query as INFO log.
+
 2010-04-28  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* Changes, NEWS, ChangeLog: Summarized changes.
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Wed Apr 28 15:10:11 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Mon May 31 07:23:21 2010 +0000
@@ -19,6 +19,7 @@
 import java.sql.Statement;
 
 import java.util.Collection;
+import java.util.Date;
 
 import org.apache.log4j.Logger;
 
@@ -80,9 +81,12 @@
                     connection = connectionPool.getConnection(this.connectionID);
                     if (connection != null){
                         Statement stmt = connection.createStatement();
+                        Date start = new Date();
                         ResultSet rs = stmt.executeQuery(queryString);
+                        Date end = new Date();
+                        log.info("-> Database query took " +
+                            (end.getTime() - start.getTime()) + " ms.");
                         returnValue = super.createResultCollection(rs);
-
                     }else{
                         log.error("Could not establish Databaseconnection.");
                         throw new QueryException("Could not establish Databaseconnection.");

http://dive4elements.wald.intevation.org