我正在使用Hibernate作为个人项目。 在我的项目,我有这些目录:无法禁用休眠日志消息
+ CONF
log4j.properties
+斌
我的班
使用Windows控制台,我去项目目录(bin和conf的父亲),然后用这样的命令启动应用程序:
java -cp conf;lib/lib1.jar;lib/lib2.jar;[etc] com.moc.Main
我log4j.properties文件是这样(从休眠示例截取):
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d - %m%n log4j.rootLogger=info, stdout log4j.logger.org.hibernate=error log4j.logger.org.hibernate.tool.hbm2ddl=error log4j.logger.org.hibernate.hql.ast.QueryTranslatorImpl=error log4j.logger.org.hibernate.hql.ast.HqlSqlWalker=error log4j.logger.org.hibernate.hql.ast.SqlGenerator=error log4j.logger.org.hibernate.hql.ast.AST=error
在应用程序启动,这是输出:
2010-11-06 19:00:56,376 - Logger.getRootLogger().info() statement 12 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.5.3-Final 13 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found 16 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist 20 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling 108 [main] INFO org.hibernate.cfg.Configuration - configuring from resource: com/moc/hibernate.cfg.xml 108 [main] INFO org.hibernate.cfg.Configuration - Configuration resource: com/moc/hibernate.cfg.xml 124 [main] INFO org.hibernate.cfg.Configuration - Reading mappings from file: conf\hiber\Customer.hbm.xml . . . and so on . . . 795 [main] INFO org.hibernate.impl.SessionFactoryImpl - closing 795 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:mysql://localhost/mydb
的休眠日志行的颜色是红色的,我的日志线是黑色的。
为什么我仍然看到Hibernate的INFO输出?我究竟做错了什么?
Hibernate使用SFL4J进行日志记录。你的类路径中究竟有哪些JAR?什么SFL4J绑定?你只有log4j作为日志后端? – 2010-11-07 09:47:24