-->
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.  [ 7 posts ] 
Author Message
 Post subject: how to get complete sql logging?
PostPosted: Tue May 06, 2008 3:38 pm 
Newbie

Joined: Tue May 06, 2008 3:35 pm
Posts: 7
I need to have complete logging of SQL for all INSERTS, UPDATES and DELETES. I cannot find a way to have the prepared statements enter the values used in those statements. Is there a log4j setting I am missing? Or am I going to have to make my own solution?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 06, 2008 3:56 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Enable TRACE logging for org.hibernate.type and DEBUG for org.hibernate.SQL and you'll have most everything. You can also use a tool like P6Spy.

-Chris

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 10:20 am 
Newbie

Joined: Tue May 06, 2008 3:35 pm
Posts: 7
Thanks for the reply, I have those enabled and that is how I am getting the "UPDATE foo set report=?, title=? WHERE id=?"

I need those ? values somehow.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 10:26 am 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Look at the subsequent log lines for org.hibernate.type. They will give you all the bind parameters, one per log line. So you'll see something like this:

1725 DEBUG org.hibernate.SQL - update CHILD set PARENT_ID=? where ID=?
1726 DEBUG org.hibernate.type.LongType - binding '1' to parameter: 1
1726 DEBUG org.hibernate.type.LongType - binding '1' to parameter: 2

Enjoy.

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 12:49 pm 
Newbie

Joined: Tue May 06, 2008 3:35 pm
Posts: 7
Ahh my mistake, fat fingered the logging stuffs. TRACE on type does give me the info.
Is it possible to further define that I only care about whats going in my SQL and not get the "RETURNING ..." pieces? The returning output is making my logs exceed 15mb+ in a few queries =/


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 07, 2008 1:09 pm 
Red Hat Associate
Red Hat Associate

Joined: Mon Aug 16, 2004 11:14 am
Posts: 253
Location: Raleigh, NC
Not in the current codebase because both get and set are encapsulated in *Type. This has come up before and I thought there was a JIRA for it but I can't find it just now. You'd only really want this in a local or dev environment (due to log size and possibly security issues) so maybe P6spy is the way to go for you (AFIAK it is a bit more configurable).

_________________
Chris Bredesen
Senior Software Maintenance Engineer, JBoss


Top
 Profile  
 
 Post subject: suggestion
PostPosted: Sun May 11, 2008 9:03 am 
Senior
Senior

Joined: Sun Jun 11, 2006 10:41 am
Posts: 164
Hi,
what dbms are you using? You can always enable tracing/logging on the server side (not in production of course).


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