Commit c6978a8a authored by lee_mingzhu's avatar lee_mingzhu

解决打印参数时,第一个打印this的问题

parent 71a90e2a
...@@ -48,12 +48,14 @@ public class ParamLogAdvice { ...@@ -48,12 +48,14 @@ public class ParamLogAdvice {
e.printStackTrace(); e.printStackTrace();
} }
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
int index = 0;
if(null != paramNames) { if(null != paramNames) {
for(int i = 0; i < paramNames.length; i ++) { for(int i = 0; i < paramNames.length; i ++) {
if(paramNames.equals("this")){ if(paramNames[i].equals("this")){
continue; continue;
} }
buffer.append(paramNames[i]).append(":").append(params[i]).append(" "); buffer.append(paramNames[i]).append(":").append(params[index]).append(" ");
index = i;
} }
String logInfo = buffer.toString().substring(0, buffer.toString().length() - 1); String logInfo = buffer.toString().substring(0, buffer.toString().length() - 1);
LOGGER.info("调用方法,方法名:{} , 方法参数:{}", methodName, logInfo); LOGGER.info("调用方法,方法名:{} , 方法参数:{}", methodName, logInfo);
...@@ -91,4 +93,9 @@ public class ParamLogAdvice { ...@@ -91,4 +93,9 @@ public class ParamLogAdvice {
} }
return paramNames; return paramNames;
} }
public static void main(String[] args) {
int index = 0;
System.out.println(--index);
}
} }
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