logback中打印sql语句
2024-10-19 08:38:13
To log SQL statements for particular mybatis mapper set DEBUG (TRACE to see query parameters and results) level for logger with fully qualified mapper name
这里的name值mapper接口的全限定名
<logger name="com.mycompany.myapp.mapper.MyMapper" level="DEBUG"/>
You can log all SQL statements from all mappers if they are in the same package like this
这里的name值mapper接口所在的包名
<logger name="com.mycompany.myapp.mapper" level="DEBUG"/>
日志的级别需要是DEBUG
原因:mybatis源代码BaseExceutor.java
protected Connection getConnection(Log statementLog) throws SQLException { Connection connection = transaction.getConnection(); if (statementLog.isDebugEnabled()) { return ConnectionLogger.newInstance(connection, statementLog, queryStack); } else { return connection; } }
refer:http://stackoverflow.com/questions/21718097/how-to-configure-logback-for-mybatis-to-print-my-sql
最新文章
- Android 网络HTML查看器
- XCOJ 1103 (LCA+树链最大子段和)
- J2EE maven pom.xml常用的jar包
- php向数据库写数据逻辑
- 【转】在Ubuntu上下载、编译和安装Android最新源代码
- 排序(5)---------高速排序(C语言实现)
- 具体解释VB中连接access数据库的几种方法
- 提交(post)xml文件给指定url的2种方法
- FastStone Capture(FSCapture) 注册码 _图形图像_软件教程_脚本之家
- 使用block实现两个页面之间的传统价值观
- SSIS从理论到实战,再到应用(3)----SSIS包的变量,约束,常用容器
- tmux配置
- JVM内存分析
- 分布式锁的几种使用方式(redis、zookeeper、数据库)
- vue+axios完美实现前端路由拦截
- php面试题整理(一)
- pycharm修改注释颜色
- Codeforces 862D. Mahmoud and Ehab and the binary string 【二分】(交互)
- 记oracle使用expdp将数据导出到asm报错
- Linux:ldd命令详解