springboot中打印sql语句
在配置⽂件中 l 配置如下其⼀即可
⽅式⼀:
logging:
level:
打印出来的形式如下:
2019-01-2408:02:14.245 [http-nio-8060-exec-2] DEBUG c.U.getUsernameExistSet 159 - ==> Preparing: SELECT username FROM user_info WHERE username in ( ? , ? , ? )
2019-01-2408:02:14.245 [http-nio-8060-exec-2] DEBUG c.U.getUsernameExistSet 159 - ==> Parameters: nike16(String), nike14(String), nike15(String)
2019-01-2408:02:14.307 [http-nio-8060-exec-2] DEBUG c.U.getUsernameExistSet 159 - <==
Total: 0
2019-01-2408:02:14.323 [http-nio-8060-exec-2] DEBUG c.apper.UserMapper.saveBatch 159 - ==> Preparing: INSERT INTO user_info ( username, password, email, telphone, birthday, createTime, updateTime ) values ( ?, ?, ?, ?, ?, ?, ? 2019-01-2408:02:14.323 [http-nio-8060-exec-2] DEBUG c.apper.UserMapper.saveBatch 159 - ==> Parameters: nike14(String), 4f757a334d69b32b586f3694fbaaa9a9869aee184f98e009b6e02b170f92eb9f(String), hgaha@qq(String), 2019-01-2408:02:14.338 [http-nio-8060-exec-2] DEBUG c.apper.UserMapper.saveBatch 159 - <== Updates: 3
⽅式⼆:
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 sql.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]
springboot原理pdf
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2e943ddb]
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论