How to Inhibit display of information in the eclipse console using hibernate

3

I would like some help. I'm developing a system using jpa-hibernate, jsf and primefaces. Whenever I run the application the following appears on the console:

0 [http-8080-2] INFO  org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.3.0.GA
46 [http-8080-2] INFO  org.hibernate.cfg.Environment - Hibernate 3.2.5
62 [http-8080-2] INFO  org.hibernate.cfg.Environment - hibernate.properties not found
62 [http-8080-2] INFO  org.hibernate.cfg.Environment - Bytecode provider name : cglib
78 [http-8080-2] INFO  org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
187 [http-8080-2] INFO  org.hibernate.ejb.Version - Hibernate EntityManager 3.3.1.GA
498 [http-8080-2] INFO  org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: nome da classe

here it displays all mapped classes . . .

6250 [http-8080-2] INFO  org.hibernate.tool.hbm2ddl.SchemaUpdate - schema update complete

How to inhibit the display of this information in the console?

Thank you for any help!

    
asked by anonymous 10.07.2014 / 16:24

2 answers

1

If it is only in Eclipse and has the file persistence.xml look for this line

<property name="eclipselink.logging.level" value="ALL"/>

And change from ALL to FATAL or some flag with less logging than all ( INFO , CONFIG . ERROR , WARN ).

log4j - "common" logging

Changing the configuration file

  • Simple Text

    log4j.logger.org.hibernate=info
    
  • XML file

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

log4j - SQL logging

  • Configuration File

    Delete this line if it exists :

    log4j.logger.org.hibernate.SQL = DEBUG

  • Programmatically:

    Configuration cfg = new Configuration().configure().
    .setProperty("hibernate.show_sql", "false");

I recommend that you also see the log4j manual .

    
10.07.2014 / 17:36
0

Just complementing colleague's answer Kyllopardiun , a free translation of the Hibernate-specific log categories table follows:

  
  • org.hibernate.SQL → Logs all DML SQL commands as they are executed
  •   
  • org.hibernate.type → Log all JDBC parameters
  •   
  • org.hibernate.tool.hbm2ddl → Logs all DDL SQL commands as they are executed
  •   
  • org.hibernate.pretty → Log status of all entities (maximum of 20 entities) associated with the session at flush
  •   
  • org.hibernate.cache → Logs all second-level cache activity
  •   
  • org.hibernate.transaction → Log activity related to transactions
  •   
  • org.hibernate.jdbc → Logs all JDBC resource acquisitions
  •   
  • org.hibernate.hql.internal.ast.AST → Logos ASAs   HQL and SQL during parsing of queries
  •   
  • org.hibernate.secure → Logos all JAAS authorization requests
  •   
  • org.hibernate → Loga All. This is a lot of information, but it is useful for troubleshooting .
  •   

Font : Hibernate 4.3 Manual - Configuration - Logging

To disable all logs:

XML Format

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

Format properties

log4j.logger.org.hibernate=OFF
    
09.08.2014 / 20:13