[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] How to use aspectj to all the exceptions?
|
aspectj-users,
I want to use aspectj to logger the exceptions. so I implemnt a aspect
class named LoggerAspect below.
I can catch the exceptions now, but I don't know how to get the exception
objects.
How to?
import org.aspectj.lang.Signature;
public aspect LoggerAspect {
pointcut exceptionLoggerMethods() : call (public
java.lang.Exception+.new(..))
&& !within(LoggerAspect);
before() : exceptionLoggerMethods() {
System.out.println("aspect before exception");
Signature sig = thisJoinPointStaticPart.getSignature();
System.out.println(sig.getName());
}
after() : exceptionLoggerMethods(){
System.out.println("aspect after exception");
}
after() throwing(Exception e) : execution(* *.*(..)) {
System.out.println("aspect after throwing exception");
}
}
creatxr,creatxr@xxxxxxxxxxx
2006-4-16
_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger: http://messenger.msn.com/cn