2014-06-10 5 views
3

Chaque fois que je lance mon Java sur Eclipse, il inonde la console avec les informations de journalisation:Comment désactiver la journalisation Hibernate 4.0?

Jun 10, 2014 2:34:01 AM org.hibernate.annotations.common.Version <clinit> 
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final} 
Jun 10, 2014 2:34:01 AM org.hibernate.Version logVersion 
INFO: HHH000412: Hibernate Core {4.0.0.Final} 
Jun 10, 2014 2:34:01 AM org.hibernate.cfg.Environment <clinit> 
INFO: HHH000206: hibernate.properties not found 
Jun 10, 2014 2:34:01 AM org.hibernate.cfg.Environment buildBytecodeProvider 
INFO: HHH000021: Bytecode provider name : javassist 
Jun 10, 2014 2:34:01 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure 
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!) 
Jun 10, 2014 2:34:01 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure 
INFO: HHH000115: Hibernate connection pool size: 20 
Jun 10, 2014 2:34:01 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure 

[un autre similaire ~ 60 lignes suivent]

Jusqu'à présent, je l'ai essayé (basé sur répondre ici How do you configure logging in Hibernate 4 to use SLF4J et "officielle" docs):

System.setProperty("org.jboss.logging.provider", "jdk"); 
java.util.logging.Logger.getLogger("org.hibernate").setLevel(Level.OFF); 

Mais il ne fait aucune différence. Hibernate continue de spammer la console.

Turning off hibernate logging console output a été inutile, puisque, comme indiqué dans les commentaires Hibernate 4+ utilise la journalisation JBOSS.

Répondre

1
To use JBoss Logging with Log4j, the log4j jar would also need to be available on the classpath. 

To use JBoss Logging with Log4j2, the log4j2 jar would also need to be available on the classpath. 

To use JBoss Logging with Slf4j, the slf4j-api jar would also need to be available on the classpath plus any needed slf4j backend. 

La citation ci-dessus de http://docs.jboss.org/hibernate/orm/4.3/topical/html/logging/Logging.html
donc si vous utilisez log4j, vous pouvez ajouter jar log4j à classpath, et en utilisant config log4j pour contrôler la sortie journal.

+0

Vous pouvez également utiliser Logback pour remplacer JBoss Logging. besoin de slf4j-api, de logback-core, de logback-classic et de logback.xml;) – Vito

+0

Merci d'avoir répondu, mais je veux vraiment ** désactiver ** la journalisation car elle encombre 'stderr'. – MBlanc

Questions connexes