-->
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.  [ 6 posts ] 
Author Message
 Post subject: logging sql queries
PostPosted: Wed Jun 08, 2005 11:29 am 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
My customer has a requirement to log all sql queries made. I was considering the hibernate.show_sql and log4j.

Does anyone have any suggestions, information and/or advice on how I should handle this requirement?

Thanks. :)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 08, 2005 12:24 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use log4j. the show_sql dumps the same to system.out which is inefficient compared to log4j logging to a file.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 08, 2005 12:36 pm 
Beginner
Beginner

Joined: Sun Aug 22, 2004 5:32 pm
Posts: 40
max wrote:
use log4j. the show_sql dumps the same to system.out which is inefficient compared to log4j logging to a file.


How much of an issue will this cause in production? I realize it will cause some sort of performance hit, but not sure how bad.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 08, 2005 12:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
BAD!

printing to system.out/err should not be done in a production system.

*Always* log to file and if possibly do it asynchronusly (possible with log4j) - but this can make the ordering out of sync (so you need to include a sequence number (also possible with log4j)

Go to log4j for more docs on this - not an hibernate issue any more ,)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Log4J + Hibernate + Eclipse
PostPosted: Wed Jun 08, 2005 5:29 pm 
Newbie

Joined: Wed Jun 08, 2005 12:33 pm
Posts: 9
How must I proceed to make log4j log the sql commands when using Hibernate tools within Eclipse ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 08, 2005 5:39 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
add a log4j.properties into the root of one of the libs in org.hibernate.eclipse.

-max

_________________
Max
Don't forget to rate


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