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

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM