接口执行时间

领取过慢
This commit is contained in:
2024-12-06 15:35:01 +08:00
parent 3a66ec6eda
commit ad1f5d2df2
2 changed files with 19 additions and 8 deletions

View File

@@ -31,7 +31,7 @@ public class AppApiMethodAspect {
@Around("pkg()")
// @SuppressWarnings("unchecked")
public Object around(ProceedingJoinPoint pjp) throws Throwable {
String start = DateUtils.format(new Date());
long start = System.currentTimeMillis();
// 执行被拦截的方法
Object result = pjp.proceed();
//请求的参数
@@ -40,9 +40,10 @@ public class AppApiMethodAspect {
String resultJson = new Gson().toJson(result);
//获取request
HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
String end = DateUtils.format(new Date());
log.info("\n>>>>>> 开始时间:{} 结束时间:{} \n>>>>>> {} {}\n>>>>>> {}\n>>>>>> Request: {}\n>>>>>> Response: {}",
start,end,request.getMethod(), request.getRequestURL(), IPUtils.getIpAddr(request),
long end = System.currentTimeMillis();
log.info("\n>>>>>> {} {}\n>>>>>> IP: {} \n>>>>>> execute time:{}\n>>>>>> Request: {}\n>>>>>> Response: {}",
request.getMethod(), request.getRequestURL(), IPUtils.getIpAddr(request),end-start,
params,
resultJson
);