From 31b92e21c4c5b1f178e7dc1bb5b784bcf2d30663 Mon Sep 17 00:00:00 2001 From: SongZhang <2064194730@qq.com> Date: Wed, 25 Sep 2024 11:09:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=8F=91=E7=8E=AF=E5=A2=83=E6=89=93?= =?UTF-8?q?=E5=8D=B0sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/RequestLoggingConfig.java | 30 +++++++++++++++++++ src/main/resources/application-dev.yml | 14 +++++---- src/main/resources/application-prod.yml | 10 +++---- src/main/resources/application.yml | 14 +++++++-- 4 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 src/main/java/com/chaozhanggui/system/cashierservice/config/RequestLoggingConfig.java diff --git a/src/main/java/com/chaozhanggui/system/cashierservice/config/RequestLoggingConfig.java b/src/main/java/com/chaozhanggui/system/cashierservice/config/RequestLoggingConfig.java new file mode 100644 index 0000000..e5207cf --- /dev/null +++ b/src/main/java/com/chaozhanggui/system/cashierservice/config/RequestLoggingConfig.java @@ -0,0 +1,30 @@ +package com.chaozhanggui.system.cashierservice.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; +import org.springframework.web.filter.CommonsRequestLoggingFilter; + +@Configuration +public class RequestLoggingConfig { + @Bean + @Order(-9999) + public CommonsRequestLoggingFilter logFilter() { + CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter(); + // 是否记录请求的查询参数信息 + filter.setIncludeQueryString(true); + // 是否记录请求body内容 + filter.setIncludePayload(true); + filter.setMaxPayloadLength(10000); + //是否记录请求header信息 + filter.setIncludeHeaders(false); + // 是否记录请求客户端信息 + filter.setIncludeClientInfo(true); + // 设置日期记录的前缀 + filter.setBeforeMessagePrefix("\033[32;4m请求开始:"); + filter.setBeforeMessageSuffix("\033[0m"); + filter.setAfterMessagePrefix("\033[34m请求结束:"); + filter.setAfterMessageSuffix("\033[0m"); + return filter; + } +} diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 3b651d5..897205d 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -3,6 +3,11 @@ spring: url: jdbc:p6spy:mysql://rm-bp1kn7h89nz62cno1ro.mysql.rds.aliyuncs.com:3306/fycashier_test?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true username: cashier password: Cashier@1@ +# url: jdbc:mysql://rm-bp1b572nblln4jho2.mysql.rds.aliyuncs.com/fycashier?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&useJDBCCompliantTimezoneShift=true&serverTimezone=Asia/Shanghai&useSSL=false +# username: root +# password: Czg666888 +# driver-class-name: com.mysql.cj.jdbc.Driver + # driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.p6spy.engine.spy.P6SpyDriver initialSize: 5 @@ -42,11 +47,10 @@ spring: username: admin password: Czg666888 -mybatis: - configuration: - map-underscore-to-camel-case: true - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - mapper-locations: classpath:mapper/*.xml +#mybatis: +# configuration: +# map-underscore-to-camel-case: true +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl ysk: url: https://gatewaytestapi.sxczgkj.cn/gate-service/ callBackurl: https://p40312246f.goho.co/cashierService/notify/notifyCallBack diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml index d65b90c..8af19f6 100644 --- a/src/main/resources/application-prod.yml +++ b/src/main/resources/application-prod.yml @@ -40,11 +40,11 @@ spring: username: admin password: Czg666888 -mybatis: - configuration: - map-underscore-to-camel-case: true - log-impl: org.apache.ibatis.logging.stdout.StdOutImpl - mapper-locations: classpath:mapper/*.xml +#mybatis: +# configuration: +# map-underscore-to-camel-case: true +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl +# mapper-locations: classpath:mapper/*.xml ysk: url: https://gateway.api.sxczgkj.cn/gate-service/ callBackurl: https://cashier.sxczgkj.cn/cashierService/notify/notifyCallBack diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index aee6778..f02cf71 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -64,10 +64,11 @@ pagehelper: params: count=countSql logging: level: + org.springframework.web.filter.CommonsRequestLoggingFilter: debug + com.chaozhanggui.system.cashierservice.mapper: debug + com.chaozhanggui.system.cashierservice.dao: debug # web日志 - org.springframework.web: debug - # mybatis日志 - org.apache.ibatis: debug +# org.springframework.web: debug charset: # 输出控制台编码 console: UTF-8 @@ -101,3 +102,10 @@ aliyun: thirdPay: payType: fushangtong url: https://paymentapi.sxczgkj.cn + + +mybatis-plus: + global-config: + db-config: + id-type: auto + mapper-locations: classpath:mapper/*.xml