0

I'm working on Java desktop application which uses Hibernate 3. Everything works fine, but when I run my application, my output is flooded with lines like:

mar 20, 2013 8:26:07 PM org.hibernate.cfg.annotations.Version <clinit>
INFO: Hibernate Annotations 3.3.1.GA
mar 20, 2013 8:26:07 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.2.5
mar 20, 2013 8:26:07 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
mar 20, 2013 8:26:07 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: Bytecode provider name : cglib
mar 20, 2013 8:26:07 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
mar 20, 2013 8:26:07 PM org.hibernate.ejb.Version <clinit>
INFO: Hibernate EntityManager 3.3.2.GA
mar 20, 2013 8:26:08 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: persistence.Document
mar 20, 2013 8:26:08 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: Document.findAll => SELECT d FROM Document d
mar 20, 2013 8:26:08 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: Document.findById => SELECT d FROM Document d WHERE d.id = :id
mar 20, 2013 8:26:08 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: Document.findByUrl => SELECT d FROM Document d WHERE d.url = :url
mar 20, 2013 8:26:09 PM org.hibernate.cfg.annotations.EntityBinder bindTable
INFO: Bind entity persistence.Document on table DOCUMENTS
mar 20, 2013 8:26:09 PM org.hibernate.cfg.AnnotationBinder bindClass
INFO: Binding entity from annotated class: persistence.LanguageEntry
mar 20, 2013 8:26:09 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: LanguageEntry.findAll => SELECT l FROM LanguageEntry l
mar 20, 2013 8:26:09 PM org.hibernate.cfg.annotations.QueryBinder bindQuery
INFO: Binding Named query: LanguageEntry.findById => SELECT l FROM LanguageEntry l WHERE l.id = :id

How can I disable it? Will be very grateful for any advice.

user1315305
  • 1,329
  • 2
  • 11
  • 20

2 Answers2

1

See the prior answer below:

Unable to disable Hibernate log messages

It looks like it might be as easy as adding -Dlog4j.debug option to the java command line at runtime.

Community
  • 1
  • 1
Jordan
  • 2,992
  • 2
  • 20
  • 29
  • I didn't add log4j library to my project - it is added by default together with hibernate? I tried adding the option you suggested, but it didn't help. – user1315305 Mar 20 '13 at 20:18
  • Hmm See the last post on this page: [LINK](https://forum.hibernate.org/viewtopic.php?p=2402646) "Hibernate is using slf4j log facade now, to bridge to log4j, you need to put log4j and slf4j-log4j12 jars to your lib and then the log4j properties will take control Hibernate logs." – Jordan Mar 20 '13 at 20:36
  • @user1315305 did you ever get this cleared up? – Jordan Mar 21 '13 at 17:43
  • No, I had also some other issues and decided to try EclipseLink instead, and so far I'm satisfied. But anyway, thank you for your advices. – user1315305 Mar 21 '13 at 21:27
  • @user1315305 Good deal. Don't forget to up vote for helpful advice! ;) – Jordan Mar 21 '13 at 21:31
1

try to put hibernate.show_sql = false in hibernate properties

PSR
  • 39,804
  • 41
  • 111
  • 151