JPA添加sql输出日志
<dependency>
<groupId>org.bgee.log4jdbc-log4j2</groupId>
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
<version>1.16</version>
</dependency>
- 添加log4jdbc.log4j2.properties文件
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
spring:
datasource:
url: jdbc:mysql://xxxx:3306/xxxx?useUnicode=true&characterEncoding=UTF8
username: xxxx
password: xxxx
sql-script-encoding: utf-8
spring:
datasource:
url: jdbc:log4jdbc:mysql://xx.xx.xx.xx:3306/xxxx?useUnicode=true&characterEncoding=UTF8
username: xxxx
password: xxxx
sql-script-encoding: utf-8
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy