1
在這種情況下如何避免重複錄入?如何在AspectJ中使用@After和@AfterThrowing中的一個?
@AfterThrowing(pointcut="execution(String greeting(..))",throwing="e")
public void itsAFoo1(JoinPoint joinPoint, RemoteException e) {
logger.error(joinPoint.getSignature().toLongString() + " exception here!");
}
@After("execution(String greeting(..))")
public void itsAFoo2(JoinPoint joinPoint, RemoteException e) {
logger.error(joinPoint.getSignature().toLongString());
}
我有兩個日誌:
[2012-08-07 17:02:01,585] [request1344351718430] [public java.lang.String componentC.Hello.greeting(java.lang.String) exception here!]
[2012-08-07 17:02:01,585] [request1344351718430] [public java.lang.String componentC.Hello.greeting(java.lang.String)]
但我需要得到一個,如果有一個例外,一個,如果沒有。