springmvc+jpa+hibernate 日志打印

jar包添加


        
            com.googlecode.log4jdbc
            log4jdbc
            1.2
        

打印日志级别

log4j.logger.log4jdbc.debug=warn
log4j.logger.jdbc.audit=warn
log4j.logger.jdbc.sqlonly=warn
log4j.logger.jdbc.resultset=warn

mysql配置

connection.url=jdbc:log4jdbc:mysql://192.168.2.119:3306/rdms-pollution?useUnicode=true&characterEncoding=utf-8
connection.username=root
connection.password=root
connection.driverClassName =net.sf.log4jdbc.DriverSpy

spring datasource配置


entityManagerFactory中jpaProperties可以去掉下面两行了

${hibernate.show_sql}
true

你可能感兴趣的:(springmvc+jpa+hibernate 日志打印)