From d3241cf50435616ebe95e87281e7454b08f2f457 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Mon, 30 Dec 2024 18:26:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sqx/common/aspect/AppApiMethodAspect.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java b/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java index ed6f6707..eace275f 100644 --- a/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java +++ b/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java @@ -46,18 +46,22 @@ public class AppApiMethodAspect { // 执行被拦截的方法 Object result = pjp.proceed(); long end = System.currentTimeMillis(); + HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); + String method = request.getMethod(); + String requestUrl = request.getRequestURL().toString(); + String requestIp = IPUtils.getIpAddr(request); + long useTime = end - start; ThreadUtil.execAsync(() -> { //请求的参数 String resultJson = new Gson().toJson(result); try { - HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); if (StringUtils.isNotBlank(resultJson) && !"null".equals(resultJson)) { log.info("\n>>>>>> {} {}" + - "\n>>>>>> IP: {} " + - "\n>>>>>> execute time:{}ms " + - "\n>>>>>> Request: {}" + - "\n>>>>>> Response: {}", - request.getMethod(), request.getRequestURL(), IPUtils.getIpAddr(request), end - start, + "\n>>>>>> IP: {} " + + "\n>>>>>> execute time:{}ms " + + "\n>>>>>> Request: {}" + + "\n>>>>>> Response: {}", + method, requestUrl, requestIp, useTime, params, resultJson );