Set Compile-Time Weaving with log4j logging
Compile-time logging with log4j logging To run aopc with logging turned on, but defaulting to the System.out logger, we run aopc with when running the aopc post-compiler, so logging of the weaving is now turned on. In this case both jboss-logging-log4j.jar and log4j.jar are on the classpath, so JBoss AOP will now use the log4j logging mechanism. To get any meaningful output, you need a log4j.properties on the classpath as was the case when using loadtime weaving. To run: $ ant run.aopc.log4j.logging We get much the same output as we did in the Compile-time logging with System.out logging case, but this time formatted and controllable using log4j. Here is the output from aopc: aopc.log4j.logging: ... [aopc] 2007-05-16 00:03:58,468 DEBUG org.jboss.aop.instrument.Instrumentor - trying to transform POJO [aopc] 2007-05-16 00:03:58,468 DEBUG org.jboss.aop.instrument.CallerTransformer - There are no caller pointcuts! [aopc] 2007-05-16 00:03:58,468 DEBUG org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod@ae60ead5[public notwoven ()V] matches no pointcuts [aopc] 2007-05-16 00:03:58,468 DEBUG org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtMethod@7c6e6140[public boundMethod ()V] matches pointcut: execution(public void POJO->boundMethod()) [aopc] 2007-05-16 00:03:58,796 DEBUG org.jboss.aop.instrument.JoinpointSimpleClassifier - javassist.CtConstructor@4aa0ce[public POJO ()V] matches no pointcuts [aopc] 2007-05-16 00:03:58,796 DEBUG org.jboss.aop.instrument.Instrumentor - was POJO converted: true ... [aopc] Build Successful: 828 ms and here is the output from the runtime applicatiin of the aop information run.aopc.log4j.logging: ... [java] 2007-05-16 00:03:59,343 DEBUG org.jboss.aop.ClassAdvisor - Creating chains for class POJO sun.misc.Launcher$AppClassLoader@92e78c [java] 2007-05-16 00:03:59,343 DEBUG org.jboss.aop.ClassAdvisor - iterate binding file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-aop/build/output/jboss-aop-snapshot/docs/aspect-framework/examples/logging/jboss-aop.xml0 execution(public void POJO->boundMethod()) [java] [debug] method matched binding: public void POJO.boundMethod() [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.advice.AdviceBinding - added advisor: POJO from binding: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-aop/build/output/jboss-aop-snapshot/docs/aspect-framework/examples/logging/jboss-aop.xml0 [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.MethodMatchInfo - populate bindings for public void POJO.boundMethod() all bindings [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.MethodMatchInfo - 0 POJO execution(public void POJO->boundMethod()) : 1 [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.MethodMatchInfo - populate bindings for public void POJO.boundMethod() actual bindings [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.MethodMatchInfo - 0 POJO execution(public void POJO->boundMethod()) : 1 [java] 2007-05-16 00:03:59,359 DEBUG org.jboss.aop.advice.AdviceBinding - added advisor: POJO from binding: file:/C:/cygwin/home/Kabir/sourcecontrol/jboss-aop/build/output/jboss-aop-snapshot/docs/aspect-framework/examples/logging/jboss-aop.xml0 [java] --- pojo.notwoven(); --- [java] notwoven() [java] --- pojo.boundMethod(); --- [java] 2007-05-16 00:03:59,562 DEBUG org.jboss.aop.advice.AspectFactoryWithClassLoaderSupport - Using context classloader sun.misc.Launcher$AppClassLoader@92e78c to load aspect SimpleInterceptor [java] <<< Entering SimpleInterceptor [java] boundMethod [java] >>> Leaving SimpleInterceptor