hotfix - 调整记录 API Log 的逻辑
This commit is contained in:
parent
6da057194a
commit
f7779c0ab5
@ -1,7 +1,6 @@
|
|||||||
package cn.axzo.workflow.server.common.aspectj;
|
package cn.axzo.workflow.server.common.aspectj;
|
||||||
|
|
||||||
import cn.axzo.workflow.core.common.event.ApiLogEvent;
|
import cn.axzo.workflow.core.common.event.ApiLogEvent;
|
||||||
import cn.axzo.workflow.core.conf.SupportRefreshProperties;
|
|
||||||
import cn.axzo.workflow.server.common.annotation.EnvConfig;
|
import cn.axzo.workflow.server.common.annotation.EnvConfig;
|
||||||
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
||||||
import cn.axzo.workflow.server.common.config.property.WorkflowProperties;
|
import cn.axzo.workflow.server.common.config.property.WorkflowProperties;
|
||||||
@ -62,20 +61,24 @@ public class ErrorReportAspect implements Ordered {
|
|||||||
Signature signature = joinPoint.getSignature();
|
Signature signature = joinPoint.getSignature();
|
||||||
StopWatch watch = new StopWatch("running controller time");
|
StopWatch watch = new StopWatch("running controller time");
|
||||||
watch.start(signature.toShortString());
|
watch.start(signature.toShortString());
|
||||||
Object result = joinPoint.proceed();
|
Object result = null;
|
||||||
watch.stop();
|
try {
|
||||||
log.info("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
result = joinPoint.proceed();
|
||||||
|
} finally {
|
||||||
|
watch.stop();
|
||||||
|
log.info("StopWatch '{}': running time = {} 's", watch.getLastTaskName(), watch.getTotalTimeSeconds());
|
||||||
|
|
||||||
if (!signature.toShortString().contains("ExtAxApiLogServiceImpl")) {
|
if (!signature.toShortString().contains("ExtAxApiLogServiceImpl")) {
|
||||||
String type = getType(joinPoint);
|
String type = getType(joinPoint);
|
||||||
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
ApiLogEvent event = new ApiLogEvent(MDC.get(CTX_LOG_ID_MDC),
|
||||||
signature.toShortString(),
|
signature.toShortString(),
|
||||||
Objects.equals(type, "Controller") ? joinPoint.getArgs() : null,
|
Objects.equals(type, "Controller") ? joinPoint.getArgs() : null,
|
||||||
Objects.equals(type, "Controller") ? result : null,
|
Objects.equals(type, "Controller") ? result : null,
|
||||||
watch.getTotalTimeSeconds(),
|
watch.getTotalTimeSeconds(),
|
||||||
type);
|
type);
|
||||||
|
|
||||||
applicationEventPublisher.publishEvent(event);
|
applicationEventPublisher.publishEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user