Jul 16th, 2009, 09:18 PM
AOP for Logging loosing Contextual Information
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?
Tags for this Thread