modify processRequestLog
This commit is contained in:
parent
c4e76ec5ea
commit
8e66c3ea4f
@ -72,9 +72,13 @@ public class RequestLogHandlerInterceptor implements HandlerInterceptor, WebMvcC
|
|||||||
boolean isJson = JSONUtil.isTypeJSON(body);
|
boolean isJson = JSONUtil.isTypeJSON(body);
|
||||||
boolean shortLength = body.length() < 4000;
|
boolean shortLength = body.length() < 4000;
|
||||||
if (shortLength) {
|
if (shortLength) {
|
||||||
body = isJson ? JSONUtil.toJsonStr(JSONUtil.isTypeJSONObject(body) ? JSON.parseObject(body) : JSON.parseArray(body)) : body;
|
try {
|
||||||
log.info("[requestUrl:{}][method:{}][param:{}][body:{}]", requestUrl, method,
|
body = isJson ? JSONUtil.toJsonStr(JSONUtil.isTypeJSONObject(body) ? JSON.parseObject(body) : JSON.parseArray(body)) : body;
|
||||||
JSON.toJSONString(request.getParameterMap()), body);
|
log.info("[requestUrl:{}][method:{}][param:{}][body:{}]", requestUrl, method,
|
||||||
|
JSON.toJSONString(request.getParameterMap()), body);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.warn("json 转化失败[requestUrl:{},body:{}]", requestUrl, body, exception);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
log.warn("request body too long, ignore print");
|
log.warn("request body too long, ignore print");
|
||||||
@ -83,6 +87,8 @@ public class RequestLogHandlerInterceptor implements HandlerInterceptor, WebMvcC
|
|||||||
|
|
||||||
} catch (IOException ioException) {
|
} catch (IOException ioException) {
|
||||||
log.warn("打印参数失败[requestUrl:{}]", requestUrl, ioException);
|
log.warn("打印参数失败[requestUrl:{}]", requestUrl, ioException);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
log.warn("打印参数失败[requestUrl:{}]", requestUrl, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user