You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Ceki Gülcü <cg...@qos.ch> on 2001/04/11 18:42:23 UTC
RE: wrapper for Log4j for method entrance/exit?
At 11:54 22.03.2001 -0500, John wrote:
>Ceki,
>So far as I've seen (aside from AspectJ, which I shied away from because of
>the precompiler "voodoo" nature) there is not any *totally* non intrusive
>way.
>
>If you do not have the luxory of a factory that you can do the constructor
>interception at, you can do a search and replace style thingie where you:
>
>Replace: "= new " + * + ");"
>with: "= new DebugProxy.for( " + * + ") );"
>
>So: FooBarClass fb = new FooBarClass(myargs);
>Becomes: FooBarClass fb = DebugProxy.for( new FooBarClass(myargs) );
>
>And the DebugProxy class is a static class whose .for() method accepts an
>object, wraps it in a Proxy and then returns it. (typically only wrapping it
>if a debug flag is set.)
>
>Unfortunatly this uglifies your code a bit, but if you do not have a
>factory... You can tweak the DebugProxy.for method to only wrap certain
>classes, etc.
>
>In a way I'd like to see something like this added to log4j's varia package.
>I mean it *is* kinda neat (and useful too!)
John,
OK. So why don't you scratch that itch? I will gladly add your contribution to the log4j distrib. Ceki
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org