简体   繁体   中英

How do I change logging level in Hibernate4?

I have been looking for hours for a solution.

How can I change the logging level in Hibernate 4.3.6 to DEBUG?

In the official documentation it is mentioned that

Completely out of date. Hibernate uses JBoss Logging starting in 4.0. This will get documented as we migrate this content to the Developer Guide.

I have not found anything in the Developer Guide so I assume that they have not even started to document it.

The Stackoverflow post here does not help me at all. I am using Hibernate 4 as a standalone library and I do not care for any Maven, JBoss or whatever else there might be XML file.

Is there somewhere a comprehensive tutorial on how I can change the debugging level in the newest version of Hibernate?

Firstly, sorry for overlooking the question. I'll delete the comment right away.

I think they've migrated the guide but forgot to update the page. Note on the new userguide says:

This is still very much a work in progress. Help is definitely welcome!

Logging Guide states that " This is largely the seminal documentation of JBoss Logging since JBoss Logging currently provides no documentation of its own. " unfortunately.

But there are some helpful tips:

First, JBoss Logging will look for a System setting with the key org.jboss.logging.provider, which can be set to one of the following values:
-jboss
-jdk
-log4j2
-log4j
-slf4j

Next, JBoss Logging will look for a JDK service (see javadocs for java.util.ServiceLoader for details) for its "provider" contract (org.jboss.logging.Provider). If multiple are available, it will use the first one returned by the ClassLoader.

If you want to use JBoss Logging backed by another logging library you need to put their libraries on your classpath. After that you can use related configuration file(logback.xml, log4j.properties etc) to define your logging level for org.hibernate .

See if this post can help your issue. I have created this post earlier where I faced same issue. By placing log4j.properties and placing the slf4j jar file in classpath has fixed my issue. I am also using Hibernate 4.3.6

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM