|
@@ -11,6 +11,8 @@ import jakarta.servlet.http.HttpServletRequest;
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
import org.aspectj.lang.ProceedingJoinPoint;
|
|
import org.aspectj.lang.annotation.Around;
|
|
import org.aspectj.lang.annotation.Around;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.aop.support.AopUtils;
|
|
import org.springframework.aop.support.AopUtils;
|
|
import org.springframework.core.annotation.Order;
|
|
import org.springframework.core.annotation.Order;
|
|
import org.springframework.util.StopWatch;
|
|
import org.springframework.util.StopWatch;
|
|
@@ -27,6 +29,7 @@ import java.util.Objects;
|
|
@Order(2)
|
|
@Order(2)
|
|
@Aspect
|
|
@Aspect
|
|
public class LoggingAspect {
|
|
public class LoggingAspect {
|
|
|
|
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
private final LoggingService service;
|
|
private final LoggingService service;
|
|
|
|
|
|
public LoggingAspect(LoggingService service) {
|
|
public LoggingAspect(LoggingService service) {
|
|
@@ -58,7 +61,11 @@ public class LoggingAspect {
|
|
} finally {
|
|
} finally {
|
|
watch.stop();
|
|
watch.stop();
|
|
builder.executeTime(watch.getTotalTimeMillis());
|
|
builder.executeTime(watch.getTotalTimeMillis());
|
|
- this.service.asyncSave(builder.build());
|
|
|
|
|
|
+ try {
|
|
|
|
+ this.service.asyncSave(builder.build());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ this.logger.warn("日志保存报\n{}", ExceptionUtil.stacktraceToString(e));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|