Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to log all the arguments values for all methods executions?

Marcelo Augusto schrieb:
> pointcut allMethods( Object...values): execution(* *.*(*,*,*,*)) &&
> args(..);
> 
> 
> I guess I found a solution creating pointcuts for each possible
> number of arguments in a method. But that is odd.

simple -- you can use the ".." already within the execution type pattern

pointcut allMethods() : execution( * *(..) );

Then, within the advice, best use the reflective API to extract
informations about the current joinpoint which caused the advice to
trigger. Within the body of advice, the keyword "thisJoinPoint" will
give you an reflection object, from which you can get at a method
signature, and from there you use the well known Java reflection
API to get the desired array of parameter types and values.
See the API documentation for details.

Hope that helps,
Hermann Vosseler




Back to the top