当前位置: 首页 > news >正文

sql分析工具-p6spy

一,mybatisplus自带的性能分析插件在3.4后移除了,官方推荐用p6spy, SQL分析与打印 | MyBatis-Plus (baomidou.com)

二,完整的配置文件

server:port: 8080servlet:context-path: /ruleengine
spring:application:name: service-ruleenginecloud:nacos:discovery:server-addr: 10.96.0.102:8848main: allow-bean-definition-overriding: trueredis:host: 192.168.10.224password: WangYueQi@01port: 6381database: 0oauth-database: 5   datasource:username: carcreditpassword: Carcredit123url: jdbc:p6spy:mysql://192.168.10.224:3308/ruleengine?useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull&serverTimezone=GMT&useSSL=false
#    driver-class-name: com.mysql.jdbc.Driver
#    driver-class-name: com.p6spy.engine.spy.P6SpyDriver
#    driver-class-name: net.sf.log4jdbc.DriverSpydriver-class-name: com.p6spy.engine.spy.P6SpyDrivertype: com.alibaba.druid.pool.DruidDataSourcedruid:initial-size: 2min-idle: 2maxActive: 20maxWait: 60000timeBetweenEvictionRunsMillis: 60000minEvictableIdleTimeMillis: 300000validationQuery: SELECT 1testWhileIdle: truetestOnBorrow: falsetestOnReturn: falsepoolPreparedStatements: truemaxPoolPreparedStatementPerConnectionSize: 20filters: stat,slf4jconnectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000web-stat-filter:enabled: trueurl-pattern: "/*"exclusions: "*.js,*.gif,*.jpg,*.bmp,*.png,*.css,*.ico,/druid/*"stat-view-servlet:url-pattern: "/druid/*"allow: 127.0.0.1,192.168.163.1deny: 192.168.1.73reset-enable: falselogin-username: adminlogin-password: 123456servlet:multipart:max-file-size: 20MBmax-request-size: 200MBlogging:level:root: INFOcom.bpmbrain: ERRORribbon:  ReadTimeout: 60000  ConnectTimeout: 60000
hystrix:command:default:execution:isolation:thread:timeoutInMilliseconds:  60000error:msg: errors.properties
mail:from: ittest@carcredit.com.cnauth: Aa2022host: smtp.exmail.qq.comindicatorTableSync:callBackAddress: https://sit.carcredit.com.cn/ruleengine2/messageQueue/callRuleruleJobGroupId: 21xxl:job:executor:appname: job-executor-ruleengineip:port: 9991logpath: /data/applogs/xxl-job/jobhandlerlogretentiondays: 30serviceName: xxl-jobcontextPath: /xxl-job-adminaccessToken: XXXXYYYYbpm:BusiNo: com.linkstec.lmspcom.lbpm_AddOrUpdDefBo BusiNoName: BpmWebHookcallBackUrl: lb://service-ruleenginecallBackContext: /ruleengine/decisionTree/callNodeendCallBackContext: /ruleengine/decisionTree/endCallNodecallBackTranContext: /ruleengine/decisionTree/callTranexecute: exerNo: 2534exerName: 规则引擎专属账号
autoreject:scoreCardCode: pre_score_card_newruleLogPath: C:\\Users\\carcredit\\Desktop\\test\\ruleLog
decisionTreeLogPath: C:\\Users\\carcredit\\Desktop\\test\\decisiontreelog
decisionTreeTranLogPath: C:\\Users\\carcredit\\Desktop\\test\\decisionTreeTranLog# ruleLogPath: /home/nas/ruleLog
# decisionTreeLogPath: /home/nas/decisiontreelog
# decisionTreeTranLogPath: /home/nas/decisionTreeTranLogexcel:templatePath: /home/nas/rulefileexcelPath: /home/nas/rulefilej2cache:config-location: /j2cache.propertiesrule_back_url: https://sit.carcredit.com.cn/ruleengine#mybatis-plus:
#  configuration:
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
#  global-config:
#    db-config:
#      banner: false
#  # 3.5.x 已内置性能分析插件
#  interceptor:
#   performance:
#      max-time: 0      # 0 表示不限,单位毫秒
#      format: true     # 控制台打印 SQL + 耗时decorator:datasource:p6spy:# 日志格式log-format: "\ntime:%(executionTime) || sql:%(sql)\n"# 自定义日志类logging: customcustom-appender-class: com.cfam.ruleengine.config.StdoutLogger

三,

spy.properties:
# 模块列表,根据版本选择合适的配置
modulelist=com.baomidou.mybatisplus.extension.p6spy.MybatisPlusLogFactory,com.p6spy.engine.outage.P6OutageFactory# 自定义日志格式
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger# 日志输出到控制台
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger# 取消JDBC驱动注册
deregisterdrivers=true# 使用前缀
useprefix=true# 排除的日志类别
excludecategories=info,debug,result,commit,resultset# 日期格式
dateformat=yyyy-MM-dd HH:mm:ss# 实际驱动列表
# driverlist=org.h2.Driver# 开启慢SQL记录
outagedetection=true# 慢SQL记录标准(单位:秒)
outagedetectioninterval=2
driverlist=com.mysql.jdbc.Driver# 过滤 flw_ 开头的表 SQL 打印
filter=true
exclude=flw_*

四:

StdoutLogger:
package com.cfam.ruleengine.config;public class StdoutLogger extends com.p6spy.engine.spy.appender.StdoutLogger {public void logText(String text) {System.out.println(text );}
}

 

http://www.sczhlp.com/news/5167/

相关文章:

  • ModbusRTU转CCLink网关控制除湿机配置案例—配置软件篇
  • PyTorch 卷积神经网络
  • P3809【模板】后缀排序
  • Z-Info硬件检测4件套 便捷绿色版 硬件监测组合套装工具
  • docker内apt-get update Waiting for headers 0%
  • CF2077G RGB Walking 题解
  • CGDC|网易伏羲揭秘AI Agent等技术驱动游戏玩法革新,重塑交互与内容生态
  • 。。。
  • ARC203
  • 基于retinex理论,利用双边滤波器对低照度彩色图像进行增强
  • ActiveMQ安装完成后网页后台确无法连接的解决方法
  • 22个软件工程师面试问题(附答案)——技术解析与应对策略
  • Linux配置Nacos开机自启动
  • 医院文件摆渡系统:解决数据跨网难题,保障传输安全!
  • 2025纷享销客华东战区年中渠道赋能大会成功举行
  • FTP替代软件:破解企业数据安全与效率的双重困局!
  • 含风电场的十机24时系统机组出力优化算法
  • 280、近试上张水部
  • 供应商协同管理系统升级:从伙伴管理突破协作瓶颈!
  • 题解:CF954H Path Counting
  • 【一文解读】Ftrans Ferry如何重构跨网文件交换的“黄金三角”?
  • python acceptable character错误
  • JeecgBoot开源低代码平台 v3.8.2震撼发布:AI低代码革命,智能开发新纪元!
  • PyTorch神经网络
  • 【2025-08-02】连岳摘抄
  • 什么是 Operational Data Hub?它因何而生,又为何能够在当下成为技术共识?
  • Linux SSH 服务配置文件核心参数详解
  • 数据库进阶-视图
  • 【2025最新】Cursor AI全流程指南!你不得不用的AI编程神器!
  • 向量数据库Milvus