[http-apr-8080-exec-1] INFO org.hibernate.cfg.annotations.Version - Hibernate Annotations 3.3.1.GA
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Environment - Hibernate 3.2.5
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Environment - Bytecode provider name : cglib
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Configuration - configuring from resource: hibernateMYSQL.cfg.xml
[http-apr-8080-exec-1] INFO org.hibernate.cfg.Configuration - Configuration resource: hibernateMYSQL.cfg.xml
[http-apr-8080-exec-1] DEBUG org.hibernate.util.DTDEntityResolver - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
[http-apr-8080-exec-1] DEBUG org.hibernate.util.DTDEntityResolver - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
[http-apr-8080-exec-1] DEBUG org.hibernate.util.DTDEntityResolver - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - dialect=org.hibernate.dialect.MySQLDialect
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.driver_class=com.mysql.jdbc.Driver
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - current_session_context_class=thread
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - show_sql=false
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.acquire_increment=1
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.idle_test_period=300
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.timeout=28800
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.max_size=25
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.min_size=1
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.max_statement=0
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.Configuration - hibernate.c3p0.preferredTestQuery=select 1;
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.AnnotationConfiguration - null<-org.dom4j.tree.DefaultAttribute@72bdc0 [Attribute: name class value
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
[http-apr-8080-exec-1] DEBUG org.hibernate.cfg.SettingsFactory - Wrap result sets: disabled
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
[http-apr-8080-exec-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
在我的项目中我有
log4j-1.2.15.jar
slf4j-api-1.5.6.jar
slf4j-log4j12-1.5.6
slf4j-simple-1.4.3
这是我的log4j.properties文件
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=${catalina.base}/logs/project/project.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=3
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=ERROR
并将以下代码添加到hibernate.prperties文件
中hibernate.show_sql = false
但是仍然在hibernate中为每个数据库操作获取大量的控制台输出。如何关闭这些日志消息?
答案 0 :(得分:0)
您可以从log4j的属性文件中控制hibernate包的日志级别:
# basic log level for all messages
log4j.logger.org.hibernate=ERROR
编辑:发布你的“hibernateMYSQL.cfg.xml” - 看起来就是它正在使用的配置文件