From 6208d2b008bb1e456deed5b39257d88741747a74 Mon Sep 17 00:00:00 2001 From: liaozan <378024053@qq.com> Date: Thu, 25 Jan 2024 12:14:44 +0800 Subject: [PATCH] Add clientIp for request logging --- .../com/schbrain/common/web/servlet/RequestLoggingFilter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commons/web-common/src/main/java/com/schbrain/common/web/servlet/RequestLoggingFilter.java b/commons/web-common/src/main/java/com/schbrain/common/web/servlet/RequestLoggingFilter.java index e9761a7..7d14ec1 100644 --- a/commons/web-common/src/main/java/com/schbrain/common/web/servlet/RequestLoggingFilter.java +++ b/commons/web-common/src/main/java/com/schbrain/common/web/servlet/RequestLoggingFilter.java @@ -2,6 +2,7 @@ package com.schbrain.common.web.servlet; import cn.hutool.core.text.CharPool; import com.schbrain.common.web.support.BaseOncePerRequestFilter; +import com.schbrain.common.web.utils.ServletUtils; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -46,6 +47,7 @@ public class RequestLoggingFilter extends BaseOncePerRequestFilter { if (StringUtils.isNotBlank(requestBody)) { builder.append(", body: ").append(requestBody); } + builder.append(", clientIp: ").append(ServletUtils.getClientIP(request)); builder.append(", start: ").append(startTime); builder.append(", end: ").append(endTime); builder.append(", cost: ").append(endTime - startTime).append("ms"); -- GitLab