MCPcopy Create free account
hub / github.com/Bit0r/java-util / recordLog

Method recordLog

src/main/java/util/LogRecodeAspect.java:70–93  ·  view source on GitHub ↗
(ProceedingJoinPoint point)

Source from the content-addressed store, hash-verified

68 return result;
69 }
70 public Object recordLog(ProceedingJoinPoint point) throws Throwable {
71 ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
72 HttpServletRequest request = (HttpServletRequest) Objects.requireNonNull(attributes).getRequest();
73 String methodName = point.getSignature().getName();
74 Object result = point.proceed();
75 if(methodName.startsWith("update")||methodName.startsWith("save")){
76 // 打印请求相关参数
77 long startTime = System.currentTimeMillis();
78 String traceId = request.getAttribute("trace_id").toString();
79// final ControllerAspectseLog l = ControllerAspectseLog.builder()
80// .ip(getIp(request))
81// .url(request.getRequestURL().toString())
82// .httpMethod(request.getMethod())
83// .requestParams(getNameAndValue(point))
84// .result(result)
85// .timeCost(System.currentTimeMillis() - startTime)
86// .traceId(traceId)
87// .springApplicationName(springApplicationName)
88// .build();
89// uploadData(l);
90 }
91
92 return result;
93 }
94
95
96// /**

Callers 1

controllerAspectseMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected