springboot + mybatis开启日志打印
mybatis日志
·
1、方法一
mybatis的添加配置文件----mybatis-config.xml如下
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- 打印sql日志 -->
<setting name="logImpl" value="STDOUT_LOGGING" />
</settings>
</configuration>
springboot的配置文件----appcation.yml中添加
mybatis:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mybatis.configuration.log-impl= org.apache.ibatis.logging.stdout.StdOutImpl
2、方法二
springboot+mybatis整合中,可以将springboot的配置文件添加
logging:
level:
com.lucifer.springboot.cache.mapper: debug
com.lucifer.springboot.cache.mapper是包名
3、方法三
springboot+mybatis-plus
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.3.1</version>
</dependency>
application.yml
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
JDBC Connection [HikariProxyConnection@1006460161 wrapping com.mysql.cj.jdbc.ConnectionImpl@37cccae8] will not be managed by Spring
==> Preparing: SELECT id,user_name,age FROM user WHERE (user_name = ?)
==> Parameters: 张三(String)
<== Columns: id, user_name, age
<== Row: 1, 张三, 18
<== Total: 1
更多推荐
已为社区贡献1条内容
所有评论(0)