@AfterThrowing
@AfterThrowing(throwing="ex", pointcut="within(com.xms.controller.*)")
public void four(Exception ex){
System.out.println("four");
ex.printStackTrace();//打印异常信息
StackTraceElement []elements=ex.getStackTrace();
//记录异常信息
System.out.println("-->"+elements[0].toString());
}
参考:https://blog.csdn.net/owen_william/article/details/50812780