Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Logging debug and info

Hi all,

I've finished reading "AspectJ In Action" and adding aspects to some small applications of my own, and now I'm trying to figure out how to use AspectJ for logging and tracing in my first "real" application. I can see how to define most of the join points which we want logged, but in ever application that my team wrote before, it seems that there are always some statements which are logged but don't follow any pattern I can detect. Most of them appear to be for debugging, sort of the official version of println() statements inside loops. I was thinking of just surrounding all System.out.println() statements with around() advice and redirecting it to our logger, but this isn't giving me warm fuzzies. Has anyone come up with a better solution?

To make things worse, it looks like some of these statements aren't all of the same priority either. So while most are DEBUG, some are INFO. That would mean that I can't assume that any System.out.println() is a debugging statement. So ideally I'd like to find some way to log arbitrary statements (possibly within loops) to the log with a user-defined priority, and yet still retain the benefits that AspectJ brings. Is this possible? Has anyone worked out any good solutions?

Thanks for any help,
-adrian.


Back to the top