jar包添加
<!--打印jdbc日志-->
<dependency>
<groupId>com.googlecode.log4jdbc</groupId>
<artifactId>log4jdbc</artifactId>
<version>1.2</version>
</dependency>
打印日志级别
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配置
<property name="driverClassName" value="${connection.driverClassName}"/>
entityManagerFactory中jpaProperties可以去掉下面两行了
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">true</prop>
网友评论