在配置文件中 application.yml 配置如下其一即可
方式一:
logging:
level:
com.xxx.com.dao.mapper: DEBUG //包路径为mapper文件包路径
打印出来的形式如下:
-- ::14.245 [http-nio--exec-] DEBUG c.s.a.m.m.U.getUsernameExistSet - ==> Preparing: SELECT username FROM user_info WHERE username in ( ? , ? , ? )
-- ::14.245 [http-nio--exec-] DEBUG c.s.a.m.m.U.getUsernameExistSet - ==> Parameters: nike16(String), nike14(String), nike15(String)
-- ::14.307 [http-nio--exec-] DEBUG c.s.a.m.m.U.getUsernameExistSet - <== Total:
-- ::14.323 [http-nio--exec-] DEBUG c.s.a.m.mapper.UserMapper.saveBatch - ==> Preparing: INSERT INTO user_info ( username, password, email, telphone, birthday, createTime, updateTime ) values ( ?, ?, ?, ?, ?, ?, ? ) , ( ?, ?, ?, ?, ?, ?, ? ) , ( ?, ?, ?, ?, ?, ?, ? )
-- ::14.323 [http-nio--exec-] DEBUG c.s.a.m.mapper.UserMapper.saveBatch - ==> Parameters: nike14(String), 4f757a334d69b32b586f3694fbaaa9a9869aee184f98e009b6e02b170f92eb9f(String), hgaha@qq.com(String), null, -- ::02.0(Timestamp), -- ::14.307(Timestamp), -- ::14.307(Timestamp), nike15(String), 18a1c9f3e7a69e3f72ab5d80caea96e5c90f5fada8f9a7e92238dc4242ba03f8(String), hgaha@qq.com(String), null, -- ::02.0(Timestamp), -- ::14.307(Timestamp), -- ::14.307(Timestamp), nike16(String), 5912bd4ff3ae134b15347610b64d9f352dd3c89dd2fb5c495cf4699683b33271(String), hgaha@qq.com(String), null, -- ::02.0(Timestamp), -- ::14.307(Timestamp), -- ::14.307(Timestamp)
-- ::14.338 [http-nio--exec-] DEBUG c.s.a.m.mapper.UserMapper.saveBatch - <== Updates:
方式二:
mybatis
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
打印出来的形式如下
Creating a new SqlSession
Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]
JDBC Connection [HikariProxyConnection@898692052 wrapping com.mysql.jdbc.JDBC4Connection@6a0c5a04] will be managed by Spring
==> Preparing: DELETE FROM user_info WHERE uid in ( ? , ? , ? )
==> Parameters: 44(Long), 45(Long), 46(Long)
<== Updates: 0
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]
Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]