[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[aspectj-users] Logging Aspect
|
Hello everyone, i've got a few questions regarding logging using aspects
I'm currently experimenting using Aspect - doing some basic logging for a
web application system.
There's this web application system i'm currently working on. The system was
using Log4j for logging, having read about the AOP and AspectJ, i decide to
replace Log4j with aspects, and see how well aspects perform.
As you know, in Log4j, there are few different types of message: FATAL,
ERROR, WARN, INFO, DEBUG.
WARN is rarely used in this system, so i can ignore about that. FATAL and
ERROR can be easily handled using handler(..) point cuts. I'm having
troubles with DEBUG and INFO. I think i can get around with INFO by using
some after() and before() advices. DEBUG is really painful to work with,
since it doesn't have any fixed locations. Programmer use it just like
System.out.println() so it's almost impossible to find pointcuts for all the
DEBUG messages. Is there any way to use aspect here?
Someone suggested that whenever a programmer wants to make a debug message,
they can just make a new object, then i can put a point cut at the
constructor of this object. for example, i can make a class,
DebugMessage(String) and a pointcut at the constructor, say, before():
call(DebugMessage.new(String))
every time we need to printout a debug message, we just do
new DebugMessage("message");
Does this sounds like a good solution? the idea of making a new object each
time we need to print something really bugs me.
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963