-->
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: Redirecting generated sql to log file?
PostPosted: Thu May 05, 2005 4:43 am 
Beginner
Beginner

Joined: Thu Oct 14, 2004 5:07 am
Posts: 37
Location: Cambridge, UK
Hi,

Is it possible to redirect show_sql output to a log file?


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 05, 2005 6:22 am 
Regular
Regular

Joined: Tue Nov 23, 2004 7:42 am
Posts: 82
Location: London, England
I don't think you can through Hibernate. However, as mentioned in this thread, you can use p6spy to log them.


Top
 Profile  
 
 Post subject: Re: Redirecting generated sql to log file?
PostPosted: Thu May 05, 2005 7:03 am 
Beginner
Beginner

Joined: Thu Mar 24, 2005 5:21 pm
Posts: 21
bendg25 wrote:
Hi,

Is it possible to redirect show_sql output to a log file?


Well, if you tweak your log4j config so:
...
<category name="org.hibernate.sql">
<priority value="DEBUG" />
<appender-ref ref="FILE" />
</category>
...

you should get the desired results.
I believe the show_sql hibernate configuration option merely causes it to System.out.println(...) the SQL which makes it impossible to redirect it to a log file without system-wide side-effects....

HTH
Satish


Top
 Profile  
 
 Post subject: Logging SQL
PostPosted: Thu May 05, 2005 7:38 am 
Beginner
Beginner

Joined: Thu Oct 14, 2004 5:07 am
Posts: 37
Location: Cambridge, UK
Hi

I tried:

log4j.logger.org.hibernate.SQL=DEBUG

and this works!! thanks

I tried this:

log4j.logger.org.hibernate.type=DEBUG

a bit too verbose for me!

What would be really cool, would be if the Dialects logged the exact SQL (values included - inline) that is being executed...

How much time would that save everybody!! :)


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.