Commit 8563fbdf authored by yanzg's avatar yanzg

不记录系统日志

parent eda03961
...@@ -191,7 +191,8 @@ public class BaseRequestAspect { ...@@ -191,7 +191,8 @@ public class BaseRequestAspect {
protected void responseLog(LogVo log, String tag, String url, boolean logFlag, ProceedingJoinPoint joinPoint, long start, Object result, Exception resultEx) { protected void responseLog(LogVo log, String tag, String url, boolean logFlag, ProceedingJoinPoint joinPoint, long start, Object result, Exception resultEx) {
try { try {
long time = System.currentTimeMillis() - start; long time = System.currentTimeMillis() - start;
boolean isLog = (logFlag && logCommon && !this.logLocal.isLog(tag, url)) || resultEx != null; boolean isLogDisplay = (logFlag && logCommon) || resultEx != null;
boolean isLogDatabase = (logFlag && log != null) || resultEx != null;
String name = joinPoint.getSignature().getName(); String name = joinPoint.getSignature().getName();
// 处理结果 // 处理结果
ResponseResult responseResult = responseDefault; ResponseResult responseResult = responseDefault;
...@@ -205,12 +206,12 @@ public class BaseRequestAspect { ...@@ -205,12 +206,12 @@ public class BaseRequestAspect {
responseResult = ExceptionHelper.getError(resultEx); responseResult = ExceptionHelper.getError(resultEx);
resultEx.printStackTrace(); resultEx.printStackTrace();
} }
if (isLog) { if (isLogDisplay) {
Log.error(joinPoint.getSignature().getDeclaringType(), resultEx, "%s [ %s ] time %d ms, result: %s", Log.error(joinPoint.getSignature().getDeclaringType(), resultEx, "%s [ %s ] time %d ms, result: %s",
tag, name, time, getMaxString(JsonHelper.serialize(responseResult))); tag, name, time, getMaxString(JsonHelper.serialize(responseResult)));
if (log != null) { }
logLocal.result(log, name, responseResult.getCode(), JsonHelper.serialize(responseResult)); if (isLogDatabase) {
} logLocal.result(log, name, responseResult.getCode(), JsonHelper.serialize(responseResult));
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
......
...@@ -73,7 +73,7 @@ public class WebAspect extends BaseRequestAspect { ...@@ -73,7 +73,7 @@ public class WebAspect extends BaseRequestAspect {
LogVo log = null; LogVo log = null;
boolean clear = requestLogInit(); boolean clear = requestLogInit();
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
String url = getMethodUrl(joinPoint); String url = HttpAspectUtil.getHttpRequestUrl();
if (clear) { if (clear) {
log = startLog(TAG, url, getRequestBody(joinPoint)); log = startLog(TAG, url, getRequestBody(joinPoint));
clear = clear && log != null; clear = clear && log != null;
......
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