• MyBatis-plus开启sql打印


    方法一:

    mybatis-plus:
      configuration:
            log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志
    

    方法二:

    logging:
      level:
        com.app.mapper: debug
    

    方法三:

    引入官方插件

            <!-- https://mvnrepository.com/artifact/p6spy/p6spy -->
            <dependency>
                <groupId>p6spy</groupId>
                <artifactId>p6spy</artifactId>
                <version>3.9.1</version>
            </dependency>
    

    yml配置

    spring:
      datasource:
        driver-class-name: com.p6spy.engine.spy.P6SpyDriver
        url: jdbc:p6spy:h2:mem:test
        ...
    

    spy.properties配置

    #3.2.1以上使用
    modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory
    #3.2.1以下使用或者不配置
    #modulelist=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
    # 自定义日志打印
    logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
    #日志输出到控制台
    appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
    # 使用日志系统记录 sql
    #appender=com.p6spy.engine.spy.appender.Slf4JLogger
    # 设置 p6spy driver 代理
    deregisterdrivers=true
    # 取消JDBC URL前缀
    useprefix=true
    # 配置记录 Log 例外,可去掉的结果集有error,info,batch,debug,statement,commit,rollback,result,resultset.
    excludecategories=info,debug,result,commit,resultset
    # 日期格式
    dateformat=yyyy-MM-dd HH:mm:ss
    # 实际驱动可多个
    #driverlist=org.h2.Driver
    # 是否开启慢SQL记录
    outagedetection=true
    # 慢SQL记录标准 2 秒
    outagedetectioninterval=2
    
  • 相关阅读:
    uglifyjs2压缩混淆js文件
    Html5应用程序缓存ApplicationCache
    nginx搭建笔记
    Free git private repo
    编程哲学之 C# 篇:007——如何创造万物
    编程哲学之 C# 篇:003——为什么选择 C#
    编程哲学之 C# 篇:004——安装 Visual Studio
    编程哲学之 C# 篇:006——什么是 .NET
    编程哲学之 C# 篇:005——"Hello,World!"
    为什么要使用Entity Framework
  • 原文地址:https://www.cnblogs.com/ice-image/p/15506900.html
Copyright © 2020-2023  润新知