Hi,

I'm trying to write a tracing aspect and would like to report any 
exceptions thrown as part of the logging format, but I can't find a way to 
express this in a generic fashion my after advice. Here is an example:

// methods annotated with @Tracing will be picked out by the tracing 
aspect
public class MyClass {

        @Tracing
        public void foo()        {
                // would like to log this exception
                throw new RuntimeException(e);
        }

}

public aspect Tracing {
        // all methods marked with @Tracing annotation
        pointcut traceableMethod(Tracing tracing) : execution(@Tracing * 
*(..)) && @annotation(tracing);

        // log exception information for all @Tracing annotated methods
        // don't want to hardcode throwing(RuntimeException) though
        after(Tracing tracing) throwing : traceableMethod(tracing) {
                // do log4j logging here
        }
}

I want to capture all types of exceptions that may be thrown, and not have 
to hardcode RuntimeException as in the example above. Is this possible in 
AspectJ?

Help appreciated
- Ashley Williams


---

This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error) please 
notify the sender immediately and delete this e-mail. Any unauthorized copying, 
disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to http://www.db.com/en/content/eu_disclosures.htm for additional 
EU corporate and regulatory disclosures.
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to