📄 loginterceptor.java
字号:
package test;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
public class LogInterceptor implements MethodInterceptor {
private Logger logger =
Logger.getLogger(this.getClass().getName());
public Object invoke(MethodInvocation methodInvocation)
throws Throwable {
logger.log(Level.INFO,
"method starts..." + methodInvocation.getMethod());
Object result = null;
try {
result = methodInvocation.proceed();
} catch(Exception e) {e.printStackTrace();}
finally {
logger.log(Level.INFO,
"method ends..." +
methodInvocation.getMethod() + "\n");
}
return result;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -