删除日志时间打印
This commit is contained in:
@@ -98,33 +98,17 @@ public class HttpLogFilter extends BaseFilter implements Ordered, BaseParams {
|
|||||||
|
|
||||||
// 获取请求日志
|
// 获取请求日志
|
||||||
JSONObject log = getRequestLog(request);
|
JSONObject log = getRequestLog(request);
|
||||||
|
|
||||||
long t1 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 记录请求日志
|
// 记录请求日志
|
||||||
saveLog(LogBusBaseType.HTTP_REQUEST, log);
|
saveLog(LogBusBaseType.HTTP_REQUEST, log);
|
||||||
|
|
||||||
long t2 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 包装请求和响应
|
// 包装请求和响应
|
||||||
ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request, DEFAULT_CACHE_LIMIT);
|
ContentCachingRequestWrapper requestWrapper = new ContentCachingRequestWrapper(request, DEFAULT_CACHE_LIMIT);
|
||||||
|
|
||||||
long t3 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
ContentCachingResponseWrapper responseWrapper = new ContentCachingResponseWrapper(response);
|
||||||
|
|
||||||
long t4 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 处理请求
|
// 处理请求
|
||||||
filterChain.doFilter(requestWrapper, responseWrapper);
|
filterChain.doFilter(requestWrapper, responseWrapper);
|
||||||
|
|
||||||
long t5 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 获取请求参数
|
// 获取请求参数
|
||||||
Object reqParam = getContent(requestWrapper.getContentAsByteArray());
|
Object reqParam = getContent(requestWrapper.getContentAsByteArray());
|
||||||
|
|
||||||
long t6 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
Object respData;
|
Object respData;
|
||||||
if (!PathPatternUtils.match(RESP_WHITE_LIST, uri)) {
|
if (!PathPatternUtils.match(RESP_WHITE_LIST, uri)) {
|
||||||
// 获取响应内容
|
// 获取响应内容
|
||||||
@@ -133,30 +117,14 @@ public class HttpLogFilter extends BaseFilter implements Ordered, BaseParams {
|
|||||||
respData = "ignore";
|
respData = "ignore";
|
||||||
}
|
}
|
||||||
|
|
||||||
long t7 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 将内容复制回原始响应
|
// 将内容复制回原始响应
|
||||||
responseWrapper.copyBodyToResponse();
|
responseWrapper.copyBodyToResponse();
|
||||||
|
|
||||||
long t8 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
// 保存日志
|
// 保存日志
|
||||||
log.put("reqBody", reqParam);
|
log.put("reqBody", reqParam);
|
||||||
log.put("respData", respData);
|
log.put("respData", respData);
|
||||||
log.put("execTime", System.currentTimeMillis() - startTime);
|
log.put("execTime", System.currentTimeMillis() - startTime);
|
||||||
|
|
||||||
long t9 = System.currentTimeMillis() - startTime;
|
|
||||||
|
|
||||||
log.put("t1", t1);
|
|
||||||
log.put("t2", t2);
|
|
||||||
log.put("t3", t3);
|
|
||||||
log.put("t4", t4);
|
|
||||||
log.put("t5", t5);
|
|
||||||
log.put("t6", t6);
|
|
||||||
log.put("t7", t7);
|
|
||||||
log.put("t8", t8);
|
|
||||||
log.put("t9", t9);
|
|
||||||
|
|
||||||
// 记录响应日志
|
// 记录响应日志
|
||||||
saveLog(LogBusBaseType.HTTP_RESPONSE, log);
|
saveLog(LogBusBaseType.HTTP_RESPONSE, log);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user