Commit c51b5a4f authored by 王亮's avatar 王亮

fix an issue(log)

parent 43111c26
...@@ -63,17 +63,19 @@ public class LogCallHttpAspect { ...@@ -63,17 +63,19 @@ public class LogCallHttpAspect {
if (TechEnvironment.isPro() && request.getRequestURL().toString().contains("/oauth/login")) { if (TechEnvironment.isPro() && request.getRequestURL().toString().contains("/oauth/login")) {
log.info("[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],exception:[{}],result:[{}]", log.info("[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],exception:[{}],result:[{}]",
request.getRequestURL(), elapsed, slowlyTag(elapsed), remoteIP, hasException, resultStr); request.getRequestURL(), elapsed, slowlyTag(elapsed), remoteIP, hasException, resultStr);
} } else {
log.info("[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],args:[{}],exception:[{}],result:[{}]", log.info("[httpRequestLog],url:[{}],duration:[{}],[耗时区间]{},remoteIP:[{}],args:[{}],exception:[{}],result:[{}]",
request.getRequestURL(), elapsed, slowlyTag(elapsed), remoteIP, JSON.toJSONString(argList), hasException, resultStr); request.getRequestURL(), elapsed, slowlyTag(elapsed), remoteIP, JSON.toJSONString(argList), hasException, resultStr);
} }
}
return result; return result;
} }
private String slowlyTag(long elapsed) { private String slowlyTag(long elapsed) {
Long second = elapsed / 1000L; long second = elapsed / 1000L;
String outTimeFormat = "[outTime_%s]"; String outTimeFormat = "[outTime_%s]";
StringBuffer sb = new StringBuffer(); StringBuilder sb = new StringBuilder();
// 3秒步长 // 3秒步长
for (int outTime = 3; outTime <= second; outTime++) { for (int outTime = 3; outTime <= second; outTime++) {
sb.append(String.format(outTimeFormat, outTime)); sb.append(String.format(outTimeFormat, outTime));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment