-->
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.  [ 9 posts ] 
Author Message
 Post subject: Viewing debug information on sql statements?
PostPosted: Mon Jul 19, 2004 12:16 pm 
Newbie

Joined: Mon Jul 19, 2004 11:54 am
Posts: 5
I turned on debugging and get information like this in my log file:

Code:
Hibernate: insert into tableA (col1, col2, col3, ) values (?, ?, ?)


How can I get the log to show the values being inserted? Is this even possible? I was using hibernate last fall and thought I was able to do it. But now I can't remember how.

I'm using hibernate 2.0.1

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 19, 2004 12:43 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Take a look at the log4j.properties in the Hibernate source, there is a logger you can enable to get the values


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 21, 2004 10:51 am 
Newbie

Joined: Mon Jul 19, 2004 11:54 am
Posts: 5
Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 12:46 am 
Regular
Regular

Joined: Thu Jul 01, 2004 12:13 am
Posts: 68
Location: San Diego, CA
I have my log4j file set-up as below, but I still only see the INSERT INTOs with the ???? marks. Am I missing some parameter?

Code:
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
#log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n

### set log levels - for more verbose logging change 'info' to 'debug' ###

log4j.rootLogger=warn, stdout

log4j.logger.net.sf.hibernate=debug

### log just the SQL
log4j.logger.net.sf.hibernate.SQL=debug

### log JDBC bind parameters ###
log4j.logger.net.sf.hibernate.type=info

### log schema export/update ###
log4j.logger.net.sf.hibernate.tool.hbm2ddl=debug

### log cache activity ###
#log4j.logger.net.sf.hibernate.cache=debug

### enable the following line if you want to track down connection ###
### leakages when using DriverManagerConnectionProvider ###
log4j.logger.net.sf.hibernate.connection.DriverManagerConnectionProvider=trace


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 6:13 am 
Newbie

Joined: Wed Jul 21, 2004 9:50 am
Posts: 2
I 've got the same problem.

which is the option to turn on/off?

thanks
esteban.-


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 8:10 am 
Regular
Regular

Joined: Tue Oct 07, 2003 10:20 am
Posts: 77
Set the log4j.logger.net.sf.hibernate.type to debug level.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 28, 2004 8:13 am 
Newbie

Joined: Wed Jul 21, 2004 9:50 am
Posts: 2
Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 21, 2005 3:53 am 
Beginner
Beginner

Joined: Tue Oct 18, 2005 10:47 am
Posts: 20
Location: Basel
Hello,

I have the same problem : I can't view what's the effective value of the SQL parameters passed to the DBMS. I still have the question marks, even if I follow the instructions specified above.

My log4j.properties :
Code:
log4j.rootLogger=DEBUG,A1

#console logging
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
# %-5p : INFO, DEBUG...
# %m%n : the message
# %d : the date with eventually formatting
# %c : class
log4j.appender.A1.layout.ConversionPattern=%-5p - %m%n

#custom logging level
# e-Serve 5 core and learn
#log4j.logger.eserve=INFO
log4j.logger.eserve=DEBUG
# DEBUG: all debug information of the JavaMail API of Sun (content of mail, very dangerous, maybe Mega bytes of Data)
log4j.logger.eserve.mail=ERROR
# DEBUG: HTTP request are written if the e-Serve servlet is used
log4j.logger.eserve.basic.stdimpl.services.servlet=DEBUG
# DEBUG: parameters of the HTTP request are written
# INFO: time used by XSLT transformation and request
log4j.logger.eserve.publish=INFO

# thirdparty libs
log4j.logger.org=ERROR
log4j.logger.com=ERROR
log4j.logger.net=ERROR
log4j.logger.java=ERROR
log4j.logger.com.mysql.jdbc=debug
log4j.logger.org.hibernate.transaction=debug
log4j.logger.org.hibernate.jdbc=debug
log4j.logger.org.hibernate.type=debug
log4j.logger.org.hibernate=debug
log4j.logger.org.hibernate.SQL=debug
log4j.logger.org.hibernate.connection.DriverManagerConnectionProvider=trace
#log4j.logger.org.hibernate.cfg=debug

I tried with log4j.logger.net.sf.hibernate instead of log4j.logger.org.hibernate but it's not working (nothing is written to the console).
Have I missed some point ?

Thank you in advance,
Joel.


Top
 Profile  
 
 Post subject: Same Problem, but I can use log4j from my code
PostPosted: Fri Oct 28, 2005 2:51 am 
Newbie

Joined: Wed Aug 24, 2005 1:08 am
Posts: 8
Have you found a solution?

I am having the same problem, I can only get Hibernate to Log SQl statments by setting <property name="hibernate.show_sql">false</property> in the hibernate.config.xml

I have setup a log4j.properties file (copied from hibernate sample. I have set everything to debug, but i still dont get any output from hibernate. If I add logging to my own code, the Log4J logs it correctly.

I am using a sevlet to load hiberante, and even tried adding a line in there before it loads hibernate to load my properties file, but still no luck
PropertyConfigurator.configure(prefix+file);


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