title: JDBC - SQL statements execution time logging
body: <p>I need to log the SQL execution times in my Java EE application (Any further statistics would be an optional bonus).</p>
  
  <p>Things are setup in a more-less standard way: Datasource on Application server serving pooled JDBC connections.</p>
  
  <p>Application uses for DB access mix of:</p>
  
  <ul>
  <li>Hibernate and</li>
  <li>Spring JDBCTemplate</li>
  </ul>
  
  <p>It runs on:</p>
  
  <ul>
  <li>Glassfish OSE and</li>
  <li>Oracle DBS</li>
  </ul>
  
  <p>I know about: <a href="https://stackoverflow.com/questions/797076/anything-better-than-p6spy">Anything better than P6Spy?</a> however the question/answers are outdated, from my point of view.</p>
  
  <p>What I've found so far:</p>
  
  <ul>
  <li>I could go for the pure Hibernate approach (<a href="https://stackoverflow.com/questions/12656452/spring-hibernate-show-query-execution-time/18204269#18204269">hibernate show query execution time</a>)
  
  <ul>
  <li>but it's not feasible due to mixed DB access in my case</li>
  </ul></li>
  <li>I could use some of the custom JDBC drivers
  
  <ul>
  <li>p6spy - however project seems couple years dead (last commit 3 years ago: <a href="http://sourceforge.net/p/p6spy/code/23/tree/trunk/" rel="nofollow noreferrer">http://sourceforge.net/p/p6spy/code/23/tree/trunk/</a>)</li>
  <li>log4jdbc - however no release for more than 1 year, and source activity seems to be cca 6 months not touched (<a href="http://code.google.com/p/log4jdbc/source/list" rel="nofollow noreferrer">http://code.google.com/p/log4jdbc/source/list</a>)</li>
  <li>another 2: log4jdbc-log4j2 and log4jdbc-remix - which seem alive, but I'm not sure about stability and broad usage</li>
  </ul></li>
  </ul>
  
  <p><strong>Recommendations based on experiences are very welcome.</strong></p>
  
  <p>Please note, I'm interested in kind of answers like: We're using XYZ and this is our experience, rather than I googled just now and feel like...</p>