Announcement Announcement Module
Collapse
No announcement yet.
AOP for Logging loosing Contextual Information Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • AOP for Logging loosing Contextual Information

    Hi,

    I'm very much interested in using Spring AOP for logging the entry and exit of all my classes.

    However, on trying it out, I'm finding that we end up loosing the contextual information of logging when using a LoggingInterceptor.

    What i mean is, using Log4J, we can use pattern like %C.%M to emit the Classname.Methodname in the logs.

    If we use LoggingInterceptor, then this will appear as LoggingInterceptor.invoke() or some other method like that, and the actual method where I want the logging to appear doesn't appear.

    I guess this will be the case all the time in the case of Proxied classes.

    Is there ANY way to introduce code into the actual class itself, so that logging appears as though its coming from those classes?

    Thanks,
    --
    Anish.

  • #2
    Originally posted by Jikes2005 View Post
    Is there ANY way to introduce code into the actual class itself, so that logging appears as though its coming from those classes?
    You might try using AspectJ as it enhances the classes at bytecode level. It is quite easily configured in Spring. Please see the reference manual for details.

    Regards,
    Andreas

    Comment

    Working...
    X