From 82cdf1d4d1a7515a341633a1584a3bbe5b00e099 Mon Sep 17 00:00:00 2001 From: ronger Date: Thu, 29 Apr 2021 10:16:30 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=8F=82=E6=95=B0=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E5=B1=8F=E8=94=BD=20password=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/rymcu/forest/config/WebLogAspect.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rymcu/forest/config/WebLogAspect.java b/src/main/java/com/rymcu/forest/config/WebLogAspect.java index ef03f35..b250c92 100644 --- a/src/main/java/com/rymcu/forest/config/WebLogAspect.java +++ b/src/main/java/com/rymcu/forest/config/WebLogAspect.java @@ -61,12 +61,18 @@ public class WebLogAspect { + joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); - logger.info("ARGS : " + Arrays.toString(joinPoint.getArgs())); + logger.info("ARGS : " + Arrays.toString(joinPoint.getArgs()) + .replaceAll("(?<=password).*?(?=(nickname|$))", "=****, ") + .replaceAll("(?<=password).*?(?=(\\)|$))", "=****)]") + .replaceAll("(?<=password).*?(?=(code|$))", "=****, ")); // 获取所有参数方法一: Enumeration enu = request.getParameterNames(); while (enu.hasMoreElements()) { - String paraName = (String) enu.nextElement(); + String paraName = enu.nextElement(); + if ("password".equals(paraName)) { + continue; + } logger.info(paraName + ": " + request.getParameter(paraName)); } }