update - 优化异步任务执行的异常信息报告

This commit is contained in:
wangli 2024-04-19 00:34:53 +08:00
parent 90a5493ce7
commit 6cb1baf326
3 changed files with 2 additions and 4 deletions

View File

@ -48,6 +48,6 @@ public class SpringAsyncConfigurer extends AsyncConfigurerSupport {
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return (ex, method, params) -> log.info(String.format("执行异步任务'%s'", method), ex);
return (ex, method, params) -> log.error(String.format("执行异步任务出现异常'%s'", method), ex);
}
}

View File

@ -13,7 +13,6 @@ import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
@ -36,7 +35,6 @@ import static cn.azxo.framework.common.constatns.Constants.CTX_LOG_ID_MDC;
@Component
@Aspect
@Slf4j
@RefreshScope
public class ErrorReportAspect implements Ordered {
@Value("${spring.profiles.active}")
private String profile;

View File

@ -30,7 +30,7 @@ public class ErrorReporterEventListener implements BpmnAsyncExecutionErrorEventL
} else if (Lists.newArrayList("live", "master").contains(profile)) {
reporterType = ReporterType.ONLY_LOG;
}
reporterType.executeAction(profile, "异步任务执行异常", sendDingTalk, new Object[]{jobInfo}, "act_ru_job", throwable);
reporterType.executeAction(profile, "异步任务执行异常, 剩余重试次数:" + jobInfo.getRetries(), sendDingTalk, new Object[]{jobInfo}, "act_ru_job", throwable);
}
@Override