Hi,
i am using spring AOP with Log4j. i have configured log4j.xml and kept it in the classpath. I have an loggingAspect class. the logging method in it works with an around annotation when i give the point cut expression right uptil the method of the service that i want to be invoked for. However, i want an expression such that it works for ALL methods of ALL packages in my application be it of any layer and it may or may not have an interface.
Could someone please provide a expression path that fulfils this?
The only required parts on t apointcut expressions is
Return Type, method, and parenthesis. For the parenthesis of parameters, nothing inside specifically means the method never takes any parameters. Hence your (..) to mean 0 or more parameters.
But returnType and method are the only required parts, and therefore the only two that need "*"
so
"execution(* *(..))" would work.
Personally though I would go a bit more descriptive with
"execution(* *..*.*(..))"
Mark
sandeeprajsingh tandon
Ranch Hand
Joined: Mar 06, 2009
Posts: 66
posted
0
Mark, what would this as specified by you mean?
"execution(* *..*.*(..))"
Kathleen and mark i would try out both the suggestions tomorrow and give an update.
sandeeprajsingh tandon
Ranch Hand
Joined: Mar 06, 2009
Posts: 66
posted
0
Thanks to both of you,
I got this working. However i didnt not use ALL STAR approach because it began to log meesages while starting glassfish server.
So i changed it to @Around("execution(* x.y.z..*.*(..))")
so it correctly prints logs for all the pakages that have a similar naming convention i.e. x.y.z.a.SomeClass
sandeeprajsingh tandon wrote:Thanks to both of you,
I got this working. However i didnt not use ALL STAR approach because it began to log meesages while starting glassfish server.
So i changed it to @Around("execution(* x.y.z..*.*(..))")
so it correctly prints logs for all the pakages that have a similar naming convention i.e. x.y.z.a.SomeClass