-->
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.  [ 3 posts ] 
Author Message
 Post subject: Enabling SQL Logging using commons-logging w/JDK 1.4 Logging
PostPosted: Mon Jun 26, 2006 6:17 pm 
Newbie

Joined: Thu Apr 22, 2004 7:36 pm
Posts: 2
The project I'm currently on is using JDK 1.4 logging. Today I attempted to get SQL statements in our logs. I turned off the show-sql in console parameter in the hibernate.cfg.xml and added the following in our logging.properties

org.hibernate.level = ALL

I see no SQL statements being logged however. I also tried explicitly configuring the SQL category with

org.hibernate.SQL.level = ALL

JDK logging does not have a "debug" level. I've tried various other JDK levels such as CONFIG as well but can't seem to get sql statements to log. Changing the org.hibernate.level to OFF does seem to turn off the INFO statements so the configuration in the logging.properties file is having some effect. Any suggestions on what I should be doing differently would be greatly appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 9:12 pm 
Newbie

Joined: Fri Jun 23, 2006 1:46 pm
Posts: 5
Have you tried configuring the log4j properties for the QueryTranslator class? It's something like

log4j.logger.net.sf.hibernate.hql.QueryTranslator= debug

in your log4j.properties.

This should show you both the HQL statement being translated and the generated SQL, although it won't show the values of any parameters in the query.

The only way I've ever figured out how to see exactly the SQL that the DB gets is to use something like P6Spy.

Hope that helps.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 26, 2006 10:15 pm 
Senior
Senior

Joined: Sun Jun 04, 2006 1:58 am
Posts: 136
Hi Scott,

I know we are struk with jdk logging :(.

Wondering if specified jvm arg

-Djava.util.logging.config.file=<path toyourlogging file>\logging.properties


Also i set

org.hibernate.SQL.level = FINE

and you have to chage the logging level for the logger you are using

eg

java.util.logging.ConsoleHandler.level = FINEST ( changed it to finest from info ( default)) I think you missed this

Also u might want to set


# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers. For any given facility this global level
# can be overriden by a facility specific level
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level= FINEST





this works fine for me .

Also hibernate uses commons logging you might want to refer to

http://jakarta.apache.org/commons/logging/apidocs/org/apache/commons/logging/impl/Jdk14Logger.html

for log level mapping between the two. ttyl

--Surya[code][/code]

_________________
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.  [ 3 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.