From 95066d1bdaf67f414f01d1686e7ea9c0ebc07e26 Mon Sep 17 00:00:00 2001 From: dongyukun <1208714201@qq.com> Date: 星期四, 02 一月 2025 09:37:05 +0800 Subject: [PATCH] 调度模型下发 --- iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java b/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java index 84c5c3d..82501a5 100644 --- a/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java +++ b/iailab-framework/iailab-common-web/src/main/java/com/iailab/framework/apilog/core/service/ApiAccessLogFrameworkServiceImpl.java @@ -3,6 +3,7 @@ import com.iailab.module.infra.api.logger.ApiAccessLogApi; import com.iailab.module.infra.api.logger.dto.ApiAccessLogCreateReqDTO; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; /** @@ -13,6 +14,7 @@ * @author iailab */ @RequiredArgsConstructor +@Slf4j public class ApiAccessLogFrameworkServiceImpl implements ApiAccessLogFrameworkService { private final ApiAccessLogApi apiAccessLogApi; @@ -20,7 +22,12 @@ @Override @Async public void createApiAccessLog(ApiAccessLogCreateReqDTO reqDTO) { - apiAccessLogApi.createApiAccessLog(reqDTO); + try { + apiAccessLogApi.createApiAccessLog(reqDTO); + } catch (Throwable ex) { + // 由于 @Async 异步调用,这里打印下日志,更容易跟进 + log.error("[createApiAccessLog][url({}) log({}) 发生异常]", reqDTO.getRequestUrl(), reqDTO, ex); + } } } -- Gitblit v1.9.3