Hibernate4.3.11 如何去掉红色的日志文字

来源:互联网 发布:淘宝男装代理一手货源 编辑:程序博客网 时间:2024/05/01 10:48
​四月13, 2017 2:41:11 下午 org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit>INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final}四月 13, 2017 2:41:11 下午 org.hibernate.Version logVersionINFO: HHH000412: Hibernate Core {4.3.11.Final}四月 13, 2017 2:41:11 下午 org.hibernate.cfg.Environment <clinit>INFO: HHH000206: hibernate.properties not found四月 13, 2017 2:41:11 下午 org.hibernate.cfg.Environment buildBytecodeProviderINFO: HHH000021: Bytecode provider name : javassist四月 13, 2017 2:41:11 下午 org.hibernate.cfg.Configuration configureINFO: HHH000043: Configuring from resource: /hibernate.cfg.xml四月 13, 2017 2:41:11 下午 org.hibernate.cfg.Configuration getConfigurationInputStreamINFO: HHH000040: Configuration resource: /hibernate.cfg.xml四月 13, 2017 2:41:12 下午 org.hibernate.cfg.Configuration addResourceINFO: HHH000221: Reading mappings from resource: com/cch/model/Student.hbm.xml四月 13, 2017 2:41:12 下午 org.hibernate.cfg.Configuration doConfigureINFO: HHH000041: Configured SessionFactory: null四月13,2017 2:41:12 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureWARN: HHH000402: Using Hibernate built-in connection pool (not for production use!)四月 13, 2017 2:41:12 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/hibernate]四月 13, 2017 2:41:12 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000046: Connection properties: {user=root, password=****}四月 13, 2017 2:41:12 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreatorINFO: HHH000006: Autocommit mode: false四月 13, 2017 2:41:12 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configureINFO: HHH000115: Hibernate connection pool size: 1 (min=1)四月 13, 2017 2:41:12 下午 org.hibernate.dialect.Dialect <init>INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLInnoDBDialect四月 13, 2017 2:41:12 下午 org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateServiceINFO: HHH000399: Using default transaction strategy (direct JDBC transactions)四月 13, 2017 2:41:12 下午 org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>INFO: HHH000397: Using ASTQueryTranslatorFactory四月 13, 2017 2:41:13 下午 org.hibernate.tool.hbm2ddl.SchemaExport executeINFO: HHH000227: Running hbm2ddl schema exportHibernate:     drop table if exists StudentHibernate:     drop table if exists _teacherHibernate:     create table Student (        id integer not null,        name varchar(255),        age integer,        primary key (id)    ) type=InnoDBHibernate:     create table _teacher (        id integer not null,        name varchar(255),        title varchar(255),        primary key (id)    ) type=InnoDB四月 13, 2017 2:41:13 下午 org.hibernate.tool.hbm2ddl.SchemaExport executeINFO: HHH000230: Schema export completeHibernate:     insert     into        _teacher        (name, title, id)     values        (?, ?, ?)四月 13, 2017 2:41:13 下午 org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl stopINFO: HHH000030: Cleaning up connection pool [jdbc:mysql://localhost:3306/hibernate]​
  • hibernate默认用的slf4j
  • 导入支持log4j的三个jar包

    导入hibernate包里的lib目录下的optional下的encache下会找到slf4j-api.jar,然后根据这个版本去下载其他两个对应的jar包slf4j-log4j12.jar和log4j12.jar,注意版本的对应。

我的是:log4j-1.2.16.jar+slf4j-api-1.6.1.jar slf4j-log4j12-1.6.1.jar

下载链接:http://download.csdn.net/detail/hgg923/8435335

  • 找到hibernate-release-4.3.11.Final\project\etc下的log4j.properties

拷进src下修改其中的配置就可以了

保留自己想看的,其它的用'#'注释掉

如:#log4j.logger.org.hibernate=debug

然后测试一下就可以了

1 0
原创粉丝点击