Commit db4a93a9 by zhiwj

打印参数

parent 28288d92
......@@ -9,8 +9,6 @@ import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.context.annotation.Configuration;
import java.lang.reflect.Method;
/**
* 采集GIC系统操作日志
*
......@@ -34,10 +32,10 @@ public class ParamAOP {
public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
try {
// 当前方法
Method currentMethod = getCurrentMethod(joinPoint);
String currentMethodName = getMethodName(joinPoint);
// 当前方法参数列表
Object[] args = joinPoint.getArgs();
logger.info("请求方法:{}, 参数:{}", currentMethod.getName(), args);
logger.info("请求方法:{}, 参数:{}", currentMethodName, args);
// 执行当前方法
return joinPoint.proceed();
} catch (Throwable throwable) {
......@@ -53,11 +51,10 @@ public class ParamAOP {
* @return
* @throws
*/
private Method getCurrentMethod(ProceedingJoinPoint joinPoint) throws NoSuchMethodException {
private String getMethodName(ProceedingJoinPoint joinPoint) throws NoSuchMethodException {
Signature signature = joinPoint.getSignature();
MethodSignature methodSignature = (MethodSignature) signature;
Object target = joinPoint.getTarget();
return target.getClass().getMethod(methodSignature.getName(), methodSignature.getParameterTypes());
return target.getClass().getName() + "." + methodSignature.getName();
}
}
\ No newline at end of file
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