ソースを参照

log 排除健康检查接口

wangyunpeng 7 ヶ月 前
コミット
f3d15a6bb9

+ 8 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/web/ControllerAspect.java

@@ -20,7 +20,8 @@ import java.util.concurrent.TimeUnit;
 @Slf4j
 public class ControllerAspect {
 
-    @Around("execution(* com.tzld.longarticle.recommend.server.web..*Controller.*(..))")
+    @Around("execution(* com.tzld.longarticle.recommend.server.web..*Controller.*(..)) " +
+            "&& !execution(* com.tzld.longarticle.recommend.server.web.HealthCheckController.ok(..))")
     public Object around(ProceedingJoinPoint pjp) throws Throwable {
         TraceUtils.setMDC();
 
@@ -31,9 +32,13 @@ public class ControllerAspect {
                 JSONUtils.toJson(pjp.getArgs()));
         Object result = pjp.proceed();
         if (result != null && result instanceof String) {
-            log.info("response result=[{}] cost=[{}]", result, stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
+            log.info("response className=[{}], method=[{}], param=[{}] result=[{}] cost=[{}]", className,
+                    signature.getName(), JSONUtils.toJson(pjp.getArgs()), result,
+                    stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
         } else {
-            log.info("response result=[{}] cost=[{}]", JSONUtils.toJson(result), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
+            log.info("response className=[{}], method=[{}], param=[{}] result=[{}] cost=[{}]", className,
+                    signature.getName(), JSONUtils.toJson(pjp.getArgs()), JSONUtils.toJson(result),
+                    stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
         }
 
         TraceUtils.removeMDC();