开发环境打印sql

This commit is contained in:
2024-09-25 11:09:46 +08:00
parent 9acad728d4
commit 31b92e21c4
4 changed files with 55 additions and 13 deletions

View File

@@ -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;
}
}

View File

@@ -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

View File

@@ -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

View File

@@ -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