spring boot中控制台打印sql日志
在application.properties中添加
#spring boot中控制台打印sql日志
#com.example.demo.dao 是dao的位置
logging.level.com.example.demo.dao=debug
最终propertites为
spring.datasource.url=jdbc:mysql://localhost:3306/c?serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
mybatis.typeAliasesPackage=com.example.demo.domain
mybatis.mapperLocations=classpath:mapper/*.xml
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
spring.jackson.time-zone=GMT+8
spring.server.MaxFileSize=50MB
spring.server.MaxRequestSize=50MB
server.port=8888
#spring boot中控制台打印sql日志
#com.example.demo.dao 是dao的位置
logging.level.com.example.demo.dao=debug
.yml中添加为
# 打印sql
logging:
level:
com.example.demo.dao : debug