|
@@ -51,17 +51,18 @@ public class LogAspect {
|
|
|
Map param = null;
|
|
|
boolean flag = false;
|
|
|
try {
|
|
|
- ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
- HttpServletRequest request = requestAttributes.getRequest();
|
|
|
+ ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
|
|
+ HttpServletRequest request = requestAttributes.getRequest();
|
|
|
|
|
|
- userId = request.getAttribute("UserId");
|
|
|
- url = request.getRequestURL().toString();
|
|
|
-
|
|
|
- param = getArgs(thisJoinPoint,((MethodSignature)thisJoinPoint.getSignature()).getParameterNames());
|
|
|
- log.info("\033[1;32m[访问地址:{}] [方法:{}] [{}] [userId:{}] [参数:{}]\033[0m",url,method,uuid,userId,param);
|
|
|
- r = thisJoinPoint.proceed ();//被代理对象执行结果
|
|
|
-
|
|
|
- } catch (Throwable e) {
|
|
|
+ userId = request.getAttribute("UserId");
|
|
|
+ url = request.getRequestURL().toString();
|
|
|
+ if (((MethodSignature) thisJoinPoint.getSignature()).getParameterNames() != null) {
|
|
|
+ param = getArgs(thisJoinPoint, ((MethodSignature) thisJoinPoint.getSignature()).getParameterNames());
|
|
|
+ log.info("\033[1;32m[访问地址:{}] [方法:{}] [{}] [userId:{}] [参数:{}]\033[0m", url, method, uuid, userId, param);
|
|
|
+ }
|
|
|
+ r = thisJoinPoint.proceed();//被代理对象执行结果
|
|
|
+
|
|
|
+ } catch (Throwable e) {
|
|
|
flag = true;
|
|
|
throw e;//异常信息有统一异常处理器处理
|
|
|
}
|