Join point 'constructor-execution(void com.AjlibTest.DummyObject.<init>())' in Type 'com.AjlibTest.DummyObject' (DummyObject.java:2) advised by before advice from 'com.AjlibTest.TestTraceAspect' (Log4jExecutionTracing.aj:17) [with runtime test]
Join point 'method-execution(int com.AjlibTest.DummyObject.someMethod(int))' in Type 'com.AjlibTest.DummyObject' (DummyObject.java:4) advised by
before advice from 'com.AjlibTest.TestTraceAspect' (Log4jExecutionTracing.aj:17) [with runtime test]
So it defintely was not weaving the Log4jExecutionTracing before advice. For verboseness here is my hacked Log4jExecutionTracing and my aspect extending it:
/**
* @author Ron Bodkin with code drawn from Matthew Webster's example posted to aj-users 1/28/2005
*/
package org.codehaus.ajlib.util.tracing;
/**
* Typical idiom of log4j tracing of method execution: trace to a different logger for
* each type.
*/
public abstract aspect Log4jExecutionTracing extends ExecutionTracing {
protected interface Traced {}
public pointcut scope() : within(Traced+);
//TODO: test, e.g., what if staticinitialization of a type when tracing something?!
//before(): staticinitialization(*) && inScope() {
before(): inScope() {
System.out.println("in log4j");
String name = thisJoinPointStaticPart.getSignature().getDeclaringTypeName();
tracer = new Log4jTracer(name);
}
}
package com.AjlibTest;
import org.codehaus.ajlib.util.tracing.Log4jExecutionTracing;
public aspect TestTraceAspect extends Log4jExecutionTracing
{
declare parents: com.AjlibTest.DummyObject implements Traced;
}
Since this posting is as long as the Magna Carta already here are my HelloWorld and DummyObject classes:
package com.AjlibTest;
public class HelloWorld
{
public static void main(String[] args)
{
DummyObject ao = new DummyObject();
ao.someMethod(5);
}
}
package com.AjlibTest;
public class DummyObject
{
public
int someMethod(int i)
{
return 7;
}
}
thanks,
owen