# HG changeset patch # User Ingo Weinzierl # Date 1275290601 0 # Node ID d387a97807a36cacd63ff32d22a3b8a42c0999a0 # Parent 1e003d3b06e834af8b6bd6d93811022dbe2370af Added an INFO log statement displaying the execution time of a database query. geo-backend/trunk@1137 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 1e003d3b06e8 -r d387a97807a3 geo-backend/ChangeLog --- 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 + + * 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 * Changes, NEWS, ChangeLog: Summarized changes. diff -r 1e003d3b06e8 -r d387a97807a3 geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java --- 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.");