Commit adcaf76f authored by yanzg's avatar yanzg

常规BUG的修改

parent d9acfbef
......@@ -129,11 +129,13 @@ public class BaseRequestAspect implements ThreadNext.Next {
* @param joinPoint
* @return
*/
protected long requestLog(String tag, ProceedingJoinPoint joinPoint) {
protected long requestLog(boolean clear, String tag, ProceedingJoinPoint joinPoint) {
long start = System.currentTimeMillis();
try {
String name = joinPoint.getSignature().getName();
Log.threadBegin();
if (clear) {
Log.threadBegin();
}
Log.info(joinPoint.getSignature().getDeclaringType(), " %s [ %s ] request: %s",
tag, name, this.getMaxString(JsonHelper.serialize(joinPoint.getArgs())));
} catch (Exception ex) {
......@@ -151,7 +153,7 @@ public class BaseRequestAspect implements ThreadNext.Next {
* @param resultEx
* @param start
*/
protected void responseLog(String tag, String url, ProceedingJoinPoint joinPoint, long start, Object result, Exception resultEx) {
protected void responseLog(boolean clear, String tag, String url, ProceedingJoinPoint joinPoint, long start, Object result, Exception resultEx) {
try {
String name = joinPoint.getSignature().getName();
if (StringHelper.isEmpty(url)) {
......@@ -194,7 +196,9 @@ public class BaseRequestAspect implements ThreadNext.Next {
} catch (Exception e) {
e.printStackTrace();
} finally {
Log.threadCommit();
if (clear) {
Log.threadCommit();
}
}
}
......
......@@ -37,7 +37,7 @@ public class FeignAspect extends BaseRequestAspect {
*/
@Around(value = "feignAspect()")
public Object requestFeignAround(ProceedingJoinPoint joinPoint) throws Throwable {
long start = requestLog(TAG, joinPoint);
long start = requestLog(false, TAG, joinPoint);
Object result = null;
Exception ex = null;
......@@ -61,7 +61,7 @@ public class FeignAspect extends BaseRequestAspect {
ex = e;
throw e;
} finally {
responseLog(TAG, StringHelper.EMPTY, joinPoint, start, result, ex);
responseLog(false, TAG, StringHelper.EMPTY, joinPoint, start, result, ex);
}
}
......
......@@ -35,7 +35,7 @@ public class MqAspect extends BaseRequestAspect {
*/
@Around(value = "mqAspect()")
public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable {
long start = requestLog(TAG, joinPoint);
long start = requestLog(true, TAG, joinPoint);
Object result = null;
Exception ex = null;
try {
......@@ -47,7 +47,7 @@ public class MqAspect extends BaseRequestAspect {
ex = e;
throw e;
} finally {
responseLog(TAG, StringHelper.EMPTY, joinPoint, start, result, ex);
responseLog(true, TAG, StringHelper.EMPTY, joinPoint, start, result, ex);
}
}
......
......@@ -58,7 +58,7 @@ public class WebAspect extends BaseRequestAspect {
@Around(value = "webAspect()")
public Object requestWebAround(ProceedingJoinPoint joinPoint) throws Throwable {
// 用户数据库记录
long start = requestLog(TAG, joinPoint);
long start = requestLog(true, TAG, joinPoint);
Object result = null;
Exception ex = null;
Ref<Boolean> flag = new Ref<>(false);
......@@ -84,7 +84,7 @@ public class WebAspect extends BaseRequestAspect {
if (!isGateWay) {
tokenFinish(flag);
}
responseLog(TAG, HttpAspectUtil.getHttpRequestUrl(), joinPoint, start, result, ex);
responseLog(true, TAG, HttpAspectUtil.getHttpRequestUrl(), joinPoint, start, result, ex);
}
}
......
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