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:

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]:

  1. if want loggin purpose have appropriate log4j debug messages wil l print time along log entry.

  2. 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

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -