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

最新文章

  1. Android 网络HTML查看器
  2. XCOJ 1103 (LCA+树链最大子段和)
  3. J2EE maven pom.xml常用的jar包
  4. php向数据库写数据逻辑
  5. 【转】在Ubuntu上下载、编译和安装Android最新源代码
  6. 排序(5)---------高速排序(C语言实现)
  7. 具体解释VB中连接access数据库的几种方法
  8. 提交(post)xml文件给指定url的2种方法
  9. FastStone Capture(FSCapture) 注册码 _图形图像_软件教程_脚本之家
  10. 使用block实现两个页面之间的传统价值观
  11. SSIS从理论到实战,再到应用(3)----SSIS包的变量,约束,常用容器
  12. tmux配置
  13. JVM内存分析
  14. 分布式锁的几种使用方式(redis、zookeeper、数据库)
  15. vue+axios完美实现前端路由拦截
  16. php面试题整理(一)
  17. pycharm修改注释颜色
  18. Codeforces 862D. Mahmoud and Ehab and the binary string 【二分】(交互)
  19. 记oracle使用expdp将数据导出到asm报错
  20. Linux:ldd命令详解

热门文章

  1. JS实现判断滚动条滚到页面底部并执行事件的方法
  2. Oracle中的case when then else end 应用
  3. 更换163的yum源
  4. Zabbix历史数据库迁移 及分区
  5. 【JBPM4】判断节点decision 方法1
  6. PHP必用代码片段
  7. php写入和读取文件内容
  8. Homebrew安装gradle及配置myeclipse
  9. C# CreateProcess的测试
  10. Codeforces Round #278 (Div. 1) Strip (线段树 二分 RMQ DP)