在Restapi这层放置一个拦截器,在日志中打印出入参的参数名和参数值:
这个主要是注意ServletRequest和ServletResponse 不能就行序列化。
package com.*.*.*.restapi.aspect;
import com.alibaba.fastjson.JSONObject;
import com.*.common.util.GSONUtil;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.lang.reflect.Method;
/**
* 日志拦截器
* Created by yang
*/
@Aspect
@Component
public class ControllerLogAspect {
private static final Logger logger = LoggerFactory.getLogger(ControllerLog