How to Inhibit Display of Information on the Eclipse Console using Hibernate

Asked

Viewed 1,316 times

4

I would like some help. I am developing a system using jpa-Ibernate, 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 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 on the console?

Bound by any help!

2 answers

1

If it’s only Eclipse and you have the file persistence.xml look for this line

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

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

log4j - logging "common"

Changing in the configuration file

  • Plain Text

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

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

log4j - logging SQL

  • Configuration File

    Delete this line if there is:

    log4j.logger.org.hibernate.SQL=DEBUG

  • By means of programming:

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

I recommend you also see the log4j manual.

  • Thank you Kyllopardiun I researched only log4j and discovered other possibilities.

  • Hello user, you can thank a user who gave a useful response through a positive vote. If the user’s response is correct you also accept it. If I have solved your problem in some different way can also contribute to the community by posting your own answer and accepting it.

0

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

  • org.hibernate.SQL Log all SQL DML commands as they are executed
  • org.hibernate.type Log all JDBC parameters
  • org.hibernate.tool.hbm2ddl Log all DDL SQL commands as they are executed
  • org.hibernate.pretty Log the status of all entities (up to 20 entities) associated with the session at the time of the flush
  • org.hibernate.cache Log all second-level cache activity
  • org.hibernate.transaction Log transaction related activities
  • org.hibernate.jdbc Log all JDBC resource acquisitions
  • org.hibernate.hql.internal.ast.AST Logas Wings HQL and SQL during the Parsing of consultations
  • org.hibernate.secure Logos all JAAS authorization applications
  • org.hibernate Loga Tudo. That’s a lot of information, but it’s useful for Troubleshooting.

Source: 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.