SpringBoot在控制台打印出执行的sql语句日志

配置application.yml或application.properties

1. 结合mybatis

1 mybatis:
2   type-aliases-package: com.example.pojo
3   mapper-locations: classpath:mapper/*.xml
4   configuration:
5     log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

2. 使用logging模块
方式一:application.yml

1 ## 设置debug可以打印Sql语句
2 logging:
3   level:
4     com:
5       company:
6         cache: debug
7   ## 或者这样写
8       com.company.cache: debug

方式二:application.properties

1 logging.level.com.company.cache=debug

 

posted @ 2021-03-31 16:34  贩卖长江水  阅读(1034)  评论(0编辑  收藏  举报