Commit ea9648f1 authored by yanzg's avatar yanzg

不记录系统日志

parent 426d1092
......@@ -191,7 +191,7 @@ public class BaseRequestAspect {
protected void responseLog(LogVo log, String tag, boolean logFlag, ProceedingJoinPoint joinPoint, long start, Object result, Exception resultEx) {
try {
long time = System.currentTimeMillis() - start;
boolean isLog = (logFlag && logCommon) || resultEx != null;
boolean isLog = (logFlag && logCommon && this.logLocal.isLog()) || resultEx != null;
String name = joinPoint.getSignature().getName();
// 处理结果
ResponseResult responseResult = responseDefault;
......
......@@ -3,6 +3,7 @@ package com.yanzuoguang.cloud.aop;
import com.yanzuoguang.util.contants.ResultConstants;
import com.yanzuoguang.util.exception.CodeException;
import com.yanzuoguang.util.exception.ExceptionHelper;
import com.yanzuoguang.util.log.Log;
import com.yanzuoguang.util.vo.LogVo;
import com.yanzuoguang.util.vo.ResponseResult;
import org.aspectj.lang.ProceedingJoinPoint;
......@@ -37,9 +38,17 @@ public class FeignAspect extends BaseRequestAspect {
*/
@Around(value = "feignAspect()")
public Object requestFeignAround(ProceedingJoinPoint joinPoint) throws Throwable {
LogVo log = null;
boolean clear = requestLogInit();
long start = requestLog(TAG, clear, joinPoint);
LogVo log = startLog(TAG, getMethodUrl(joinPoint), getRequestBody(joinPoint));
long start = System.currentTimeMillis();
if (clear) {
log = startLog(TAG, getMethodUrl(joinPoint), getRequestBody(joinPoint));
clear = clear && log != null;
}
if (clear) {
Log.threadBegin();
start = requestLog(TAG, clear, joinPoint);
}
Object result = null;
Exception ex = null;
......
......@@ -167,7 +167,7 @@ public class LogLocal implements ThreadNext.Next, InitializingBean {
* @param keys
* @return
*/
private boolean isLog(String... keys) {
public boolean isLog(String... keys) {
List<String> list = new ArrayList<>();
list.add(this.applicationName);
for (String item : keys) {
......
......@@ -45,10 +45,13 @@ public class MqAspect extends BaseRequestAspect {
boolean clear = isRabbit(joinPoint);
LogVo log = null;
long start = System.currentTimeMillis();
if (clear) {
log = startLog(TAG, getMethodUrl(joinPoint), getRequestBody(joinPoint));
clear = clear && log != null;
}
if (clear) {
Log.threadBegin();
start = requestLog(TAG, clear, joinPoint);
log = startLog(TAG, getMethodUrl(joinPoint), getRequestBody(joinPoint));
}
Object result = null;
Exception ex = null;
......
......@@ -70,10 +70,18 @@ public class WebAspect extends BaseRequestAspect {
result = executeMethod(joinPoint);
return result;
}
LogVo log = null;
boolean clear = requestLogInit();
// 用户数据库记录
long start = requestLog(TAG, clear, joinPoint);
LogVo log = startLog(TAG, HttpAspectUtil.getHttpRequestUrl(), getRequestBody(joinPoint));
long start = System.currentTimeMillis();
if (clear) {
log = startLog(TAG, getMethodUrl(joinPoint), getRequestBody(joinPoint));
clear = clear && log != null;
}
if (clear) {
Log.threadBegin();
start = requestLog(TAG, clear, joinPoint);
}
Exception ex = null;
boolean isInit = false;
try {
......
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