Commit a56798c3 authored by duanruiming's avatar duanruiming

[update] 通用日志处理逻辑注释优化

parent cf84f448
......@@ -46,7 +46,7 @@ public class LogAspectHandler {
}
/**
* 执行切点controller之前执行的逻辑
* 执行切点controller之前执行的逻辑:打印请求日志
*
* @param joinPoint
*/
......@@ -56,7 +56,6 @@ public class LogAspectHandler {
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String ip = IpAddressUtil.getIpAddress(request);
Map<String, String> map = getControllerMethodDescription(joinPoint);
//*========操作日志=========*//
OperateLog log = new OperateLog();
log.setDescription(map.get("description").toString());
log.setIp(ip);
......@@ -68,12 +67,13 @@ public class LogAspectHandler {
//打印操作日志
this.consoleLog(log, request);
} catch (Exception e) {
log.error("日志切面直行前异常,异常信息: {}", e);
log.error("打印日志信息日志切面执行异常,异常信息: {}", e);
}
}
/**
* MVC返回结果处理逻辑
* MVC返回结果处理逻辑,打印请求信息和结果信息
* todo 后续可增加日志流水表,插入流水表中
*
* @param joinPoint
* @param jsonViewObject
......@@ -89,7 +89,6 @@ public class LogAspectHandler {
String uri = request.getRequestURL().toString();
//获取信息
Map<String, String> map = getControllerMethodDescription(joinPoint);
//*========操作日志=========*//
OperateLog operateLog = new OperateLog();
operateLog.setDescription(map.get("description").toString());
operateLog.setIp(ip);
......@@ -97,10 +96,10 @@ public class LogAspectHandler {
operateLog.setOperationType(map.get("operationType").toString());
operateLog.setUrl(request.getRequestURL().toString());
operateLog.setArgs(getArgs(request, joinPoint));
operateLog.setStatus(jsonViewObject.getStatus());
operateLog.setStatus(String.valueOf(jsonViewObject.getCode()));
operateLog.setResult(JSON.toJSONString(jsonViewObject));
operateLog.setCreateTime(new Date());
log.info("\n外部系统调用本地接口,请求IP = {} || 接口 = {} || 地址 = {} || 响应状态 = {}", ip, map.get("description").toString(), uri, jsonViewObject.getStatus());
log.info("\n外部系统调用本地接口,请求IP = {} || 接口 = {} || 地址 = {} || 响应状态 = {}", ip, map.get("description").toString(), uri, jsonViewObject.getCode());
} catch (Exception e) {
//记录本地异常日志
log.error("记录本地接口响应日志异常,异常信息:{}", e);
......@@ -174,7 +173,7 @@ public class LogAspectHandler {
}
/**
* 获取@Aspect标注的controller方法
* 获取@AspectLog标注的controller方法注解信息
*
* @param joinPoint
* @return
......
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