Thanks for your response Andy.
This is not a singleton aspect. It is actually percflow(myop()) { ... where
myop() is another pointcut.
Here is a snippet of the woven output around a log statement("Entering
isValidRequest" in this case):
76: invokestatic #367; //Method
org/aspectj/runtime/reflect/Factory.makeJP:(Lorg/aspectj/lang/JoinPoint$StaticPart;Ljava/lang/Object;Ljava/lang/Object;)Lorg/aspectj/lang/JoinPoint;
79: getstatic #379; //Field
ajc$tjp_4:Lorg/aspectj/lang/JoinPoint$EnclosingStaticPart;
82: invokevirtual #355; //Method
com/mycompany/myapp/aspects/tracing/myAspect.ajc$before$com_mycompany_myapp_aspects_tracing_myAspect$4$48864b4c:(Lorg/aspectj/lang/JoinPoint;Lorg/aspectj/lang/JoinPoint$StaticPart;)V
85: getstatic #34; //Field logger:Lorg/apache/log4j/Logger;
88: ldc #48; //String Entering isValidRequest
90: invokestatic #331; //Method
com/mycompany/myapp/aspects/tracing/myAspect.hasAspect:()Z
93: ifeq 102
96: invokestatic #325; //Method
com/mycompany/myapp/aspects/tracing/myAspect.aspectOf:()Lcom/mycompany/myapp/aspects/tracing/myAspect;
99: invokevirtual #328; //Method
com/mycompany/myapp/aspects/tracing/myAspect.ajc$before$com_mycompany_myapp_aspects_tracing_myAspect$2$58016c43:()V
102: invokevirtual #50; //Method
org/apache/log4j/Logger.warn:(Ljava/lang/Object;)V
105: goto 125
108: astore 13
110: invokestatic #331; //Method
com/mycompany/myapp/aspects/tracing/myAspect.hasAspect:()Z
113: ifeq 122
116: invokestatic #325; //Method
com/mycompany/myapp/aspects/tracing/myAspect.aspectOf:()Lcom/mycompany/myapp/aspects/tracing/myAspect;
119: invokevirtual #336; //Method
com/mycompany/myapp/aspects/tracing/myAspect.ajc$after$com_mycompany_myapp_aspects_tracing_myAspect$3$58016c43:()V
122: aload 13
124: athrow
125: nop
126: invokestatic #331; //Method
com/mycompany/myapp/aspects/tracing/myAspect.hasAspect:()Z
129: ifeq 138
132: invokestatic #325; //Method
com/mycompany/myapp/aspects/tracing/myAspect.aspectOf:()Lcom/mycompany/myapp/aspects/tracing/myAspect;
135: invokevirtual #336; //Method
com/mycompany/myapp/aspects/tracing/myAspect.ajc$after$com_mycompany_myapp_aspects_tracing_myAspect$3$58016c43:()V
I am a little puzzled by what seem to be two calls to after(119 & 135).
________________________________________
From: [email protected] [[email protected]] on
behalf of Andy Clement [[email protected]]
Sent: Monday, May 30, 2011 8:56 AM
To: [email protected]
Subject: Re: [aspectj-users] Puzzling problem using AspectJ
Hi,
So you are not loadtime weaving, you are just compile time weaving.
The weaveinfo messages indicate the bytecode is being modified. I
guess you could check the woven output from the compile and verify the
calls to the logger have been advised. Using 'javap -private
-verbose' against a class in the woven output you should see wherever
there is a call to getLogger there is a call to the advice?
Actually, one thing does seem unusual. Is your pointcut definetly just this:
call(* org.apache.log4j.Logger.*(..)) && !within(*..*Aspect);
and in a singleton aspect?
Because that can be fully statically matched, so I don't understand
why your weaveinfo message is suffixed with '[with runtime test]'. If
the runtime test (whatever it is) is failing it will not be running
your advice. If you want to post the snippet of bytecode around the
calls to getLogger we can check what the runtime test is.
Andy
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users