[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Accessing join point of advised advice

Dear list,

I'd like to create an aspect that advices every execution of advice in the system. At each advice execution, I want to log (information about the) join point together with each advice that was run at that join point. The following aspect does the latter:

public aspect AdviceLogger {
	before() : adviceexecution() && !within(AdviceLogger) {
		System.out.println("Advice: " + thisJoinPoint.getSignature() + ": "
 			+ thisJoinPoint.getSourceLocation());
	}
}

But how do I get access to the join point that the advised advice was executed at, if possible?

I want something equivalent to writing code on this form inside each advice:

before() : p() {
	System.out.println("Join point:" + thisJoinPoint);
	System.out.println("Advice: void A1.before(): A1.aj:37");
}

but without having to do it inside each and every one...

Thanks,
Jon