Reputation: 241
Our current project has no log4j jars, we use JDK logging API only. Now i needed to see the values of HQL statements, which are currently displayed with "?","?".
I found a lot of tips, using LOG4J. But no solution found with JDK:---((
I have set the following in logging.properties
:
org.hibernate.level=TRACE
org.hibernate.SQL.level = TRACE
.level=TRACE
But it had no effect. If I set the INFO level, so all WARNs, that I send for tests, will NOT be visible. Thus, logging.properties
is bound to Java class path
Does anybody have any ideas?
Upvotes: 1
Views: 2133
Reputation: 11020
I have encountered the same issue and doesn't want to use another logging facility.
I ended up with following configuration (original question):
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=FINE
org.hibernate.level=WARN
org.hibernate.SQL.level=FINE
Perhaps not the best one, because it logs sometimes a lot of stuff, but it is working.
Upvotes: 0
Reputation: 45
JBoss Logging will look for a System setting with the key org.jboss.logging.provider. What you need to do is to set the system properties with that key with value "jdk", such that Hibernate will use Java logging framework for logging
System.setProperty("org.jboss.logging.provider", "jdk");
To log binding parameters in sql, you need one more statement in your logging.properties
org.hibernate.type.descriptor.sql.level=FINEST
You may refer the details from the logging guide of Hibernate http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html
Upvotes: 1
Reputation: 9443
The authoritative resource on Java JDK logging is the Java Logging Guide : http://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html
But generally speaking, JDK logging does not define a TRACE level: http://docs.oracle.com/javase/6/docs/api/java/util/logging/Level.html
Hibernate uses JBoss Logging for its logging. JBoss Logging defines a TRACE level (like most logging libraries other than the JDK); when bridging to JDK logging, JBoss Logging maps TRACE to JDK's FINER level. So you'd want to use =FINER
in your config (or =FINEST
)
Upvotes: 0