소스 검색

修改日志

humuyu 3 년 전
부모
커밋
769fb68df3
1개의 변경된 파일8개의 추가작업 그리고 6개의 파일을 삭제
  1. 8 6
      eladmin-logging/src/main/java/me/zhengjie/aspect/LogRequestParam.java

+ 8 - 6
eladmin-logging/src/main/java/me/zhengjie/aspect/LogRequestParam.java

@@ -85,7 +85,7 @@ public class LogRequestParam {
 				if (value instanceof String) {
 					String str = (String) value;
 					if (str.length() > 1000) {
-						//去掉特别长的参数
+						// 去掉特别长的参数
 						value = str.substring(0, 1000);
 					}
 				}
@@ -93,10 +93,11 @@ public class LogRequestParam {
 				params.put(param, value);
 			}
 			String json = JSON.toJSONString(params, SerializerFeature.WriteMapNullValue);
-
+			// 请求方法
+			String method = request.getMethod();
 			// 这里判断
-			Object[] obj = { ip, uri, json };
-			log.info("[request] - ip: {} , requestUrl: {} ,param: {} ", obj);
+			Object[] obj = { ip,method, uri, json };
+			log.info("[request] - ip: {} , method: {} , requestUrl: {} , param: {} ", obj);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
@@ -121,8 +122,9 @@ public class LogRequestParam {
 			// 打印输出的值
 			if (StringUtils.isNotBlank(json) && json.length() < 1500) {
 				String uri = request.getRequestURI();
-				Object obj[] = { status, uri, json };
-				log.info("[reponse] - status: {} , url:{} ,result:{}", obj);
+				String method = request.getMethod();
+				Object obj[] = { status,method, uri, json };
+				log.info("[reponse] - status: {} ,method: {}, url:{} ,result:{}", obj);
 			}
 
 		} catch (Exception e) {