Question:
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 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?
Thanks for any help!
Answer:
If it's only in Eclipse and you have the persistence.xml
file 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
-
plain 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
-
Through programming:
Configuration cfg = new Configuration().configure().
.setProperty("hibernate.show_sql", "false");
I recommend that you also see the log4j manual .