java - JDBC - SQL statements execution time logging -
i need log sql execution times in java ee application (any further statistics optional bonus).
things setup in more-less standard way: datasource on application server serving pooled jdbc connections.
application uses db access mix of:
- hibernate and
- spring jdbctemplate
it runs on:
- glassfish ose and
- oracle dbs
i know about: anything better p6spy? question/answers outdated, point of view.
what i've found far:
- i go pure hibernate approach (hibernate show query execution time)
- but it's not feasible due mixed db access in case
- i use of custom jdbc drivers
- p6spy - project seems couple years dead (last commit 3 years ago: http://sourceforge.net/p/p6spy/code/23/tree/trunk/)
- log4jdbc - no release more 1 year, , source activity seems cca 6 months not touched (http://code.google.com/p/log4jdbc/source/list)
- another 2: log4jdbc-log4j2 , log4jdbc-remix - seem alive, i'm not sure stability , broad usage
recommendations based on experiences welcome.
please note, i'm interested in kind of answers like: we're using xyz , our experience, rather googled , feel like...
if want dead accurate sql execution time best option sql trace. want put in java ee application, want accurate execution time.
following things suggest [i have implemented them in code]:
if want loggin purpose have appropriate log4j debug messages wil l print time along log entry.
i implemented batchlog table application use record start , end time of operation. in case start , end time of query. if single query triggers might here or else can update log table before , after running query. or better stored procedure can take care of whole thing , give more accurate data.
Comments
Post a Comment