修复异常打印日志BUG

This commit is contained in:
2026-04-25 11:55:40 +08:00
parent 54970fb2c8
commit 6dff429642

View File

@@ -109,7 +109,7 @@ public class HttpLogFilter extends BaseFilter implements Ordered, BaseParams {
// 处理异常日志
LogLevel level = LogLevel.INFO;
boolean printLog = true;
Boolean printLog = null;
if (!PathPatternUtils.match(RESP_WHITE_LIST, uri)) {
// 获取响应内容
Object respData = getContent(responseWrapper.getContentAsByteArray());
@@ -128,7 +128,11 @@ public class HttpLogFilter extends BaseFilter implements Ordered, BaseParams {
// 将内容复制回原始响应
responseWrapper.copyBodyToResponse();
// 记录响应日志
LogBus.init(level, LogBusBaseType.HTTP_REQUEST).print(printLog).data(log).save();
LogBus logBus = LogBus.init(level, LogBusBaseType.HTTP_REQUEST).data(log);
if (Objects.nonNull(printLog)) {
logBus.print(printLog);
}
logBus.save();
}
/**