-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: How to get better sql instrumentation / logging?
PostPosted: Thu Jun 16, 2005 12:52 am 
Beginner
Beginner

Joined: Thu Aug 28, 2003 7:05 pm
Posts: 20
I know that I can enable sql logging (using show_sql=true), but is there a way to get better instrumentation. For example, include the following in the log:

- log the sql and the hsql (with the named parameters)
- log the parameters bound to the statement
- log the time taken to execute the sql
- control the format of the log
- determine if the sql should be logged

It would be nice to have an interceptor that I could register that can manage the logging of all sql (loader, persister, native, named-query, generator, etc)

I have looked at the Batcher class, but I do not think it is in the right spot.

Thanks
Gavin


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 16, 2005 2:28 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
- enable org.hibernate.type debug log
- write a custom log4j appender
- use p6spy or similar

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 05, 2007 4:00 am 
Newbie

Joined: Fri Jan 05, 2007 3:50 am
Posts: 1
Location: Zürich, Switzerland
It's true that you can get the bind variables via writing a log4j buffered appender - but that is some work, it's not simple and easy to do.
And p6spy seems not to make your own interceptor possible.

I used the appender for tracing of sql and bind variables after jdbc exceptions in a production environment.
I have seen that the new Interceptor has a method onPreparedStatement which gives you the sql.

Is it planned to give it another method exposing the bind variables, too?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.