Menu ▾ ▴

Refining Target Methods

To refine the target methods for M0bG3n Load Time Logging, we need the knowledge about the AspectJ pointcut usage. The actual refinement is possible in the META-INF/aop.xml file inside the __logger-loadtime-aspect*.jar__s.

The default content of aop.xml file is as follows:


<aspectj>
<aspects>
    <concrete-aspect name="net.sf.mobg3n.logging.aspect.ConcreteLoggerAspect"
        extends="net.sf.mobg3n.logging.aspect.AbstractLoggerAspect">
        <pointcut name="loggerAspectExcludes"
            expression="!within(java.*..*) 
            &amp;&amp; !within(javax.*..*) 
            &amp;&amp; !within(org.eclipse.*..*) 
            &amp;&amp; !within(org.apache.*..*) 
            &amp;&amp; !within(junit.*..*)
            " />
        <pointcut name="loggerAspectTargetMethods" expression="execution(* *..*(..))" />
    </concrete-aspect>
</aspects>

<!-- <weaver options="-showWeaveInfo"/> -->

</aspectj>

There are two pointcut names that are configured here and they are the following:

+loggerAspectExcludes

Normally we put all the packages that we wanted to exclude in aspect advices here. By default this excludes java, javax, org.eclipse, org.apache and junit packages and their sub-packages.

+loggerAspectTargetMethods

This is where we target the methods we wanted to be advised. By default this targets all the methods that are not excluded by loggerAspectExcludes pointcut.

Note: Both pointcuts use AspectJ expressions.


Related

Wiki: MObG3n Logger Home
Wiki: Using Load Time Logging in Tomcat 7
Wiki: Using Load Time Logging