一、mybatisplus打印SQL语句
1、配置文件为application.yml格式
#mybatis-plus配置控制台打印完整带参数SQL语句
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
2、配置文件为application.properties格式
#mybatis-plus配置控制台打印完整带参数SQL语句
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
二、Springboot下jdbcTemplate打印SQL语句配置
1、方式一在yaml文件配置
logging:
level:
org.springframework.jdbc.core.JdbcTemplate: DEBUG
2、在logback.xml里加入如下配置
<include resource="org/springframework/boot/logging/logback/base.xml"/>
<logger name="org.springframework.jdbc.core" additivity="false" level="DEBUG" >
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
</logger>