-->
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.  [ 4 posts ] 
Author Message
 Post subject: Help setting a new log level in Hibernate 4.1.2
PostPosted: Thu May 03, 2012 10:28 am 
Newbie

Joined: Thu May 03, 2012 10:19 am
Posts: 2
Hi,

I am a Hibernate newbie and have vanilla install of 4.1.2 (no extras at all). All I want to turn up the log level to see fullSQL statements.

Any help would be really appreciated! Appollogies if this gets asked 1000's of times.

There seems to be no out of the box documentation on how to do this very simple task. (Lots of stuff about Log back / Log 4J etc. all of which are not relevant for me)


Top
 Profile  
 
 Post subject: Re: Help setting a new log level in Hibernate 4.1.2
PostPosted: Thu May 03, 2012 4:47 pm 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
There are several configurable properties:

Quote:
hibernate.show_sql
hibernate.format_sql
hibernate.use_sql_comments
...


http://docs.jboss.org/hibernate/core/4.1/manual/en-US/html_single/#configuration-optional

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
 Post subject: Re: Help setting a new log level in Hibernate 4.1.2
PostPosted: Fri May 04, 2012 3:17 am 
Newbie

Joined: Thu May 03, 2012 10:19 am
Posts: 2
Thank you for the quick reply.

I was already using the option 'hibernate.show_sql' which is simple and well documented.

Could you tell me a straight forward ('out of the box') way of getting Hibernate to print the value of the parameters that it is binding to the SQL? (And other useful 'Trace' style debug)

Best wishes,

S :-)


Top
 Profile  
 
 Post subject: Re: Help setting a new log level in Hibernate 4.1.2
PostPosted: Fri May 04, 2012 6:04 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hibernate isn't actually able to do that since it uses prepared statements all the time (as it's much more efficient), and keeping this context around for logging would complicate things significantly.
This is a limitation of the JDBC design, what people usually do during development is to use special JDBC drivers.. search the web for "jdbc spy", "P6Spy", or have a look into http://code.google.com/p/log4jdbc/

they should all be easy to setup and nicely separated, so you're sure you won't miss anything as Hibernate can't possible escape that ;)

_________________
Sanne
http://in.relation.to/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.