Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] How to log both the caller object and the executing object of a setter pointcut

Hello everyone,

I am trying to write a logger, and need to log both the caller object and
the executing object of a setter call. I used a field set point cut,
however, found no caller's context can be obtained from the 'thisJoinPoint.'
Can anyone please give me some hints to solve the problem? 

And I have the similar problem in logging object creation. If I used a
constructor call join point, the executing object couldn't be obtained, as
the target ( thisJoinPoint.getTarget() ) always would be null (Why?). But by
using the constructor execution join point, I can't collect the caller's
context (Is there a way to access caller's context with a execution join
point?)  I worked out  an awkward solution to this, as I used a temp
variable to store the caller's information with a constructor call pointcut,
and pass it along with the 'thisJoinPoint' from the constructor execution
poincut to the actual logger. Is there a better way to do this?

Any suggestion would be valuable for me, thanks.

    
-- 
View this message in context: http://old.nabble.com/How-to-log-both-the-caller-object-and-the-executing-object-of-a-setter-pointcut-tp27896906p27896906.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top