Hi

For this type of horizontal logging concern, an Aspect Oriented
Programming (AOP) solution can be applied.  Choose an AOP library - I
recommend AspectJ [1], then create pointcuts matching entry to all the
methods/classes you are interested in.  You can capture the parameters
and call the logging API from a simple aspect advising each method.
You can choose between compile-time, post-compile-time (binary
weaving) or runtime (load-time weaving) approaches to weave-in the
logging advice.

The advantage of an AOP approach is that you don't need to add any
code to each method requiring log-on-entry (or return).  This also
means you can easily remove any logging overhead at a later time.

Take a look at the Perf4j [2] project if you are looking for examples
of code which is advised to add logging statements - in this case it
is capturing method-execution timings using around-advice.

Best
Brett

[1] http://www.eclipse.org/aspectj/
[2] http://perf4j.codehaus.org/

On 20 January 2013 08:12, Vajrakumar Dindalakopp <[email protected]> wrote:
> Hello team,
>
> Usually this is a quite common requirement I guss to log all the input
> parameters to a method to a log with DEBUG modifier so that it can be
> controlled.
>
> I agree this we can achieve by writing logs using log4j with DEBUG priority
> at the starting of all methods .
> My question is :
> " Is there a common way using which no need to write tgis line,
> automatically when new method created it has this line. And you can control
> wether to print or not these input parameters."
>
> A code sample may be really helpfull.
>
> Something like Log4E plugin for eclipse I need to do in Netbeans.
>
> Thanking you in advance.
> --
> With Regards,
> **
> *Vajrakumar N. D*

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to