From a8589c5d9afb667d5ea3b9a4400cc8d4ade86a8b Mon Sep 17 00:00:00 2001 From: Hccake Date: Wed, 10 Apr 2024 23:15:41 +0800 Subject: [PATCH] =?UTF-8?q?:alien:=20=E5=90=8C=E6=AD=A5=20ballcat=20?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E5=BA=93=E6=94=B9=E5=8A=A8=EF=BC=8C=E8=AE=BF?= =?UTF-8?q?=E9=97=AE=E6=97=A5=E5=BF=97=E7=9A=84=E6=9C=80=E5=A4=A7=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E4=BD=93=E9=95=BF=E5=BA=A6=E4=B8=8B=E6=B2=89=E5=88=B0?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../org/ballcat/admin/upms/log/BallcatLogConfiguration.java | 1 - .../business/log/filter/BusinessAccessLogFilter.java | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ballcat-admin/ballcat-admin-core/src/main/java/org/ballcat/admin/upms/log/BallcatLogConfiguration.java b/ballcat-admin/ballcat-admin-core/src/main/java/org/ballcat/admin/upms/log/BallcatLogConfiguration.java index 3fc5143..6832889 100644 --- a/ballcat-admin/ballcat-admin-core/src/main/java/org/ballcat/admin/upms/log/BallcatLogConfiguration.java +++ b/ballcat-admin/ballcat-admin-core/src/main/java/org/ballcat/admin/upms/log/BallcatLogConfiguration.java @@ -83,7 +83,6 @@ public AbstractAccessLogFilter businessAccessLogFilter(AccessLogService accessLo BusinessAccessLogFilter businessAccessLogFilter = new BusinessAccessLogFilter(defaultRecordOptions, accessLogRules, new AccessLogSaveThread(accessLogService), principalAttributeAccessor, defaultFilterLogLevel); - businessAccessLogFilter.setMaxBodyLength(accessLogProperties.getMaxBodyLength()); businessAccessLogFilter.setOrder(accessLogProperties.getFilterOrder()); return businessAccessLogFilter; } diff --git a/ballcat-business-log/ballcat-log-biz/src/main/java/org/ballcat/business/log/filter/BusinessAccessLogFilter.java b/ballcat-business-log/ballcat-log-biz/src/main/java/org/ballcat/business/log/filter/BusinessAccessLogFilter.java index d63ad27..0b3563a 100644 --- a/ballcat-business-log/ballcat-log-biz/src/main/java/org/ballcat/business/log/filter/BusinessAccessLogFilter.java +++ b/ballcat-business-log/ballcat-log-biz/src/main/java/org/ballcat/business/log/filter/BusinessAccessLogFilter.java @@ -97,12 +97,14 @@ protected void afterRequest(HttpServletRequest request, HttpServletResponse resp // 记录请求体 if (recordOptions.isIncludeRequestBody()) { - accessLog.setRequestBody(getRequestBody(request)); + String requestBody = getRequestBody(request, recordOptions.getMaxRequestBodyLength()); + accessLog.setRequestBody(requestBody); } // 记录响应体 if (recordOptions.isIncludeResponseBody()) { - accessLog.setResponseBody(getResponseBody(response)); + String responseBody = getResponseBody(response, recordOptions.getMaxResponseBodyLength()); + accessLog.setResponseBody(responseBody); } // 如果登录用户 则记录用户名和用户id