Commit 68166749 authored by yanzg's avatar yanzg

不记录系统日志

parent 93255d30
...@@ -3,7 +3,6 @@ package com.yanzuoguang.cloud.aop; ...@@ -3,7 +3,6 @@ package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.util.contants.ResultConstants; import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.exception.CodeException; import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.exception.ExceptionHelper; import com.yanzuoguang.util.exception.ExceptionHelper;
import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.LogVo; import com.yanzuoguang.util.vo.LogVo;
import com.yanzuoguang.util.vo.ResponseResult; import com.yanzuoguang.util.vo.ResponseResult;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
...@@ -38,16 +37,13 @@ public class FeignAspect extends BaseRequestAspect { ...@@ -38,16 +37,13 @@ public class FeignAspect extends BaseRequestAspect {
*/ */
@Around(value = "feignAspect()") @Around(value = "feignAspect()")
public Object requestFeignAround(ProceedingJoinPoint joinPoint) throws Throwable { public Object requestFeignAround(ProceedingJoinPoint joinPoint) throws Throwable {
LogVo log = null; Class declaringType = joinPoint.getSignature().getDeclaringType();
boolean clear = requestLogInit();
long start = System.currentTimeMillis();
String url = getMethodUrl(joinPoint); String url = getMethodUrl(joinPoint);
log = startLog(TAG, url, getRequestBody(joinPoint)); String requestBody = getRequestBody(joinPoint);
clear = clear && log != null; boolean clear = requestLogInit();
if (clear) { long start = requestLog(declaringType, TAG, url, requestBody, clear);
Log.threadBegin(); LogVo log = startLog(TAG, url, requestBody);
start = requestLog(TAG, clear, joinPoint);
}
Object result = null; Object result = null;
Exception ex = null; Exception ex = null;
...@@ -71,7 +67,7 @@ public class FeignAspect extends BaseRequestAspect { ...@@ -71,7 +67,7 @@ public class FeignAspect extends BaseRequestAspect {
ex = e; ex = e;
throw e; throw e;
} finally { } finally {
responseLog(log, TAG, url, clear, joinPoint, start, result, ex); responseLog(declaringType, TAG, url, clear, start, result, ex, log);
} }
} }
......
...@@ -2,7 +2,6 @@ package com.yanzuoguang.cloud.aop; ...@@ -2,7 +2,6 @@ package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.mq.plan.YzgMqConsumer; import com.yanzuoguang.mq.plan.YzgMqConsumer;
import com.yanzuoguang.util.exception.ExceptionHelper; import com.yanzuoguang.util.exception.ExceptionHelper;
import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.LogVo; import com.yanzuoguang.util.vo.LogVo;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
...@@ -43,17 +42,15 @@ public class MqAspect extends BaseRequestAspect { ...@@ -43,17 +42,15 @@ public class MqAspect extends BaseRequestAspect {
@Around(value = "mqAspect()") @Around(value = "mqAspect()")
public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable { public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable {
boolean clear = isRabbit(joinPoint); boolean clear = isRabbit(joinPoint);
LogVo log = null;
long start = System.currentTimeMillis();
String url = getMethodUrl(joinPoint);
if (clear) {
log = startLog(TAG, url, getRequestBody(joinPoint));
clear = clear && log != null;
}
if (clear) { if (clear) {
Log.threadBegin(); clear = clear && requestLogInit();
start = requestLog(TAG, clear, joinPoint);
} }
Class declaringType = joinPoint.getSignature().getDeclaringType();
String url = getMethodUrl(joinPoint);
String requestBody = getRequestBody(joinPoint);
long start = requestLog(declaringType, TAG, url, requestBody, clear);
LogVo log = startLog(TAG, url, requestBody);
Object result = null; Object result = null;
Exception ex = null; Exception ex = null;
try { try {
...@@ -65,7 +62,7 @@ public class MqAspect extends BaseRequestAspect { ...@@ -65,7 +62,7 @@ public class MqAspect extends BaseRequestAspect {
ex = e; ex = e;
throw e; throw e;
} finally { } finally {
responseLog(log, TAG, url, clear, joinPoint, start, result, ex); responseLog(declaringType, TAG, url, clear, start, result, ex, log);
} }
} }
......
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