From 8c912a81331f46c929b7d3107f2ff383c042ea35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?=
<15040126243@163.com>
Date: Thu, 5 Aug 2021 13:30:36 +0800
Subject: [PATCH] =?UTF-8?q?add=20=E9=9B=86=E6=88=90=20=E6=80=A7=E8=83=BD?=
=?UTF-8?q?=E5=88=86=E6=9E=90=E6=8F=92=E4=BB=B6=20p6spy=20=E6=9B=B4?=
=?UTF-8?q?=E5=BC=BA=E5=8A=B2=E7=9A=84=20SQL=20=E5=88=86=E6=9E=90?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 7 +++++
.../src/main/resources/application-dev.yml | 4 ++-
.../src/main/resources/application-prod.yml | 4 ++-
.../src/main/resources/application.yml | 6 +++--
ruoyi-admin/src/main/resources/spy.properties | 26 +++++++++++++++++++
ruoyi-common/pom.xml | 5 ++++
6 files changed, 48 insertions(+), 4 deletions(-)
create mode 100644 ruoyi-admin/src/main/resources/spy.properties
diff --git a/pom.xml b/pom.xml
index 0bdc04f0..1c32623d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -26,6 +26,7 @@
1.7
0.9.1
3.4.3
+ 3.9.1
5.7.6
3.0.3
11.2
@@ -118,6 +119,12 @@
mybatis-plus-extension
${mybatis-plus.version}
+
+
+ p6spy
+ p6spy
+ ${p6spy.version}
+
cn.hutool
diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index 8cd5d8b9..ab2a0e80 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -4,7 +4,9 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
- #设置默认的数据源或者数据源组,默认值即为 master
+ # 性能分析插件(有性能损耗 不建议生产环境使用)
+ p6spy: true
+ # 设置默认的数据源或者数据源组,默认值即为 master
primary: master
datasource:
# 主库数据源
diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml
index 9f290014..b807394b 100644
--- a/ruoyi-admin/src/main/resources/application-prod.yml
+++ b/ruoyi-admin/src/main/resources/application-prod.yml
@@ -4,7 +4,9 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource
# 动态数据源文档 https://www.kancloud.cn/tracy5546/dynamic-datasource/content
dynamic:
- #设置默认的数据源或者数据源组,默认值即为 master
+ # 性能分析插件(有性能损耗 不建议生产环境使用)
+ p6spy: false
+ # 设置默认的数据源或者数据源组,默认值即为 master
primary: master
datasource:
# 主库数据源
diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml
index 9377ff00..8b633f85 100644
--- a/ruoyi-admin/src/main/resources/application.yml
+++ b/ruoyi-admin/src/main/resources/application.yml
@@ -162,8 +162,10 @@ mybatis-plus:
localCacheScope: SESSION
# 开启Mybatis二级缓存,默认为 true
cacheEnabled: false
- # 更详细的日志输出 会有性能损耗
- # logImpl: org.apache.ibatis.logging.stdout.StdOutImpl
+ # 更详细的日志输出 会有性能损耗 org.apache.ibatis.logging.stdout.StdOutImpl
+ # 关闭日志记录 (可单纯使用 p6spy 分析) org.apache.ibatis.logging.nologging.NoLoggingImpl
+ # 默认日志输出 org.apache.ibatis.logging.slf4j.Slf4jImpl
+ logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl
global-config:
# 是否打印 Logo banner
banner: true
diff --git a/ruoyi-admin/src/main/resources/spy.properties b/ruoyi-admin/src/main/resources/spy.properties
new file mode 100644
index 00000000..b361dbbe
--- /dev/null
+++ b/ruoyi-admin/src/main/resources/spy.properties
@@ -0,0 +1,26 @@
+# p6spy ܷļ
+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
+# ʹ־ϵͳ¼ 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
+# Ƿ Log
+filter=true
+# Log ʱųıбԶŷָ
+exclude=QRTZ_
diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml
index 5221faf1..650411f5 100644
--- a/ruoyi-common/pom.xml
+++ b/ruoyi-common/pom.xml
@@ -152,6 +152,11 @@
com.baomidou
dynamic-datasource-spring-boot-starter
+
+
+ p6spy
+ p6spy
+
com.baomidou