|
@@ -13,6 +13,7 @@ import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.annotation.Before;
|
|
import org.aspectj.lang.annotation.Before;
|
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
import org.aspectj.lang.annotation.Pointcut;
|
|
|
import org.aspectj.lang.reflect.CodeSignature;
|
|
import org.aspectj.lang.reflect.CodeSignature;
|
|
|
|
|
+import org.springframework.core.io.AbstractResource;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
import org.springframework.web.context.request.ServletRequestAttributes;
|
|
@@ -82,6 +83,11 @@ public class LogRequestParam {
|
|
|
}
|
|
}
|
|
|
value = sb.toString();
|
|
value = sb.toString();
|
|
|
}
|
|
}
|
|
|
|
|
+ if (value instanceof AbstractResource) {
|
|
|
|
|
+ AbstractResource part = (AbstractResource) value;
|
|
|
|
|
+ value = part.getFilename();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (value instanceof String) {
|
|
if (value instanceof String) {
|
|
|
String str = (String) value;
|
|
String str = (String) value;
|
|
|
if (str.length() > 1000) {
|
|
if (str.length() > 1000) {
|
|
@@ -96,7 +102,7 @@ public class LogRequestParam {
|
|
|
// 请求方法
|
|
// 请求方法
|
|
|
String method = request.getMethod();
|
|
String method = request.getMethod();
|
|
|
// 这里判断
|
|
// 这里判断
|
|
|
- Object[] obj = { ip,method, uri, json };
|
|
|
|
|
|
|
+ Object[] obj = { ip, method, uri, json };
|
|
|
log.info("[request] - ip: {} , method: {} , requestUrl: {} , param: {} ", obj);
|
|
log.info("[request] - ip: {} , method: {} , requestUrl: {} , param: {} ", obj);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -123,7 +129,7 @@ public class LogRequestParam {
|
|
|
if (StringUtils.isNotBlank(json) && json.length() < 1500) {
|
|
if (StringUtils.isNotBlank(json) && json.length() < 1500) {
|
|
|
String uri = request.getRequestURI();
|
|
String uri = request.getRequestURI();
|
|
|
String method = request.getMethod();
|
|
String method = request.getMethod();
|
|
|
- Object obj[] = { status,method, uri, json };
|
|
|
|
|
|
|
+ Object obj[] = { status, method, uri, json };
|
|
|
log.info("[reponse] - status: {} ,method:{}, url:{} ,result:{}", obj);
|
|
log.info("[reponse] - status: {} ,method:{}, url:{} ,result:{}", obj);
|
|
|
}
|
|
}
|
|
|
|
|
|