Tuesday, July 13, 2010

Turning off hibernate logging console output, How to hide/disable Hibernate log to console

Just sharing my experiance with Hibernate 3.0.

Even after using the log4j.xml with

<logger name="org.hibernate">
<level value="info"/>
</logger>


I could not able to trun off the huge hibernate log on console, it was coming like this:

7 [main] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.4.0.GA
37 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.0.SP1
43 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
48 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
52 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
163 [main] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.1.0.GA
168 [main] INFO org.hibernate.ejb.Version - Hibernate EntityManager 3.4.0.GA
202 [main] INFO org.hibernate.ejb.Ejb3Configuration - Processing PersistenceUnitInfo [

name: VMSPersistenceUnit

...]



Finally I got solution and that is here:

Just add slf4j-log4j12-1.5.2.jar in your classpath if you are using slf4j-api. Actually SLF4J is used by hibernate and if you are using log4j you need to setup the bridge for your logging system.



In my case, I have these jar files in my project classpath:


slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6.jar
slf4j-simple-1.4.2.jar


Thats it ...... :)

No comments:

Post a Comment