V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
mart1nN
V2EX  ›  问与答

springboot mybatis 打印 Sql 到控制台

  •  
  •   mart1nN · 2019-11-15 15:37:37 +08:00 · 2895 次点击
    这是一个创建于 1595 天前的主题,其中的信息可能已经有所发展或是发生改变。
    configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    

    请教师父们 想要 @Test 测试时也输出 sql 还要其他的配置吗

    2 条回复    2019-11-15 21:11:53 +08:00
    Artemisr
        1
    Artemisr  
       2019-11-15 18:52:29 +08:00
    logback 的配置这样写
    logging:
    level:
    cn.demo.business: info

    cn.demo.business 代表你 mapper 层的包名,需要看日志就把 info 改成 debug
    m1ch3ng
        2
    m1ch3ng  
       2019-11-15 21:11:53 +08:00
    可以用 mybatis log plugin 插件
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   958 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:40 · PVG 05:40 · LAX 14:40 · JFK 17:40
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.