mart1nN
V2EX  ›  问与答

springboot mybatis 打印 Sql 到控制台

  •  
  •   mart1nN · Nov 15, 2019 · 4135 views
    This topic created in 2552 days ago, the information mentioned may be changed or developed.
    configuration:
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    

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

    2 replies  •  2019-11-15 21:11:53 +08:00
    Artemisr
    Artemisr
    Nov 15, 2019
    1
    logback 的配置这样写
    logging:
    level:
    cn.demo.business: info

    cn.demo.business 代表你 mapper 层的包名,需要看日志就把 info 改成 debug
    m1ch3ng
    m1ch3ng
    Nov 15, 2019
    2
    可以用 mybatis log plugin 插件
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   980 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 19:18 · PVG 03:18 · LAX 11:18 · JFK 14:18
    ♥ Do have faith in what you're doing.