Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Newbie - need very basic examples - AspectJ annotation style

My IDE only supports annotation style with AspectJ and I am in need of
examples for annotation style.  I bought a book (no examples with annotation
style) and have read a lot of documentation but can not get this one simple
thing to work.

1) Example of an aspect that runs after any Throwable and logs the exception
(cause, message) + stack trace (any throwable anywhere Runtime exception or
checked exception.

2) Example same as the above (run after any Throwable) but limited to any
Throwable in a specific package like "com.mycompany.*"

I found examples that are non-annotation style, tried to translate them to
annotation style but they did not work.  This is such a common thing I
believe someone will have an example they can attach, email or paste into
this response.

I recently inherited a big blob of code and believe there are all sorts of
things going on under the hood that I can't see.  This would help me log any
exception anywhere and see what may be going awry.

I believe if I had examples of the @Pointcut and @After I could fill in the
body of the method to do what I need.  I'm just not sure how to catch every
throwable and then write another one that will catch every throwable given a
package name.

thanks!!!


Lisa
-- 
View this message in context: http://www.nabble.com/Newbie---need-very-basic-examples---AspectJ-annotation-style-tp19191216p19191216.html
Sent from the AspectJ - users mailing list archive at Nabble.com.



Back to the top