fix(log): 修复日志全局 includes 配置会被局部修改的问题

This commit is contained in:
2024-08-30 06:54:00 +00:00
committed by Gitee
2 changed files with 4 additions and 2 deletions

View File

@@ -47,7 +47,7 @@ public class LogProperties {
/** /**
* 包含信息 * 包含信息
*/ */
private Set<Include> includes = new HashSet<>(Include.defaultIncludes()); private Set<Include> includes = Include.defaultIncludes();
/** /**
* 放行路由 * 放行路由

View File

@@ -36,6 +36,7 @@ import top.continew.starter.log.core.model.LogResponse;
import top.continew.starter.log.interceptor.autoconfigure.LogProperties; import top.continew.starter.log.interceptor.autoconfigure.LogProperties;
import java.time.Clock; import java.time.Clock;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
/** /**
@@ -115,7 +116,8 @@ public class LogInterceptor implements HandlerInterceptor {
* @return 日志包含信息 * @return 日志包含信息
*/ */
private Set<Include> getIncludes(Log methodLog, Log classLog) { private Set<Include> getIncludes(Log methodLog, Log classLog) {
Set<Include> includeSet = logProperties.getIncludes(); Set<Include> oriIncludeSet = logProperties.getIncludes();
Set<Include> includeSet = new HashSet<>(oriIncludeSet);
if (null != classLog) { if (null != classLog) {
this.processInclude(includeSet, classLog); this.processInclude(includeSet, classLog);
} }