禁用Hibernate输出

时间:2013-03-20 19:33:18

标签: java hibernate logging desktop-application

我正在研究使用Hibernate 3的Java桌面应用程序。一切正常,但是当我运行我的应用程序时,我的输出充斥着如下行:

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

如何禁用它?对任何建议都会非常感激。

2 个答案:

答案 0 :(得分:1)

请参阅下面的先前答案:

Unable to disable Hibernate log messages

看起来它可能像在运行时向java命令行添加-Dlog4j.debug选项一样简单。

答案 1 :(得分:1)

尝试将hibernate.show_sql = false放入hibernate属性