Alex,
I don't beleive that there is anything like this built into Log4j. You can
fairly easily do it yourself though. Rather than describe it here I'll just
point to in the right direction.
Take a look at the Proxy & InvokationHandler classes. NOTE: This is only
available with JDK 1.3 I believe. If you've followed a factory pattern this
is easy to implement. If not (if you just go and "new FooBarClass()"
directly you'll have more work to do.
Hmm, there was an article that described this, wait a minute... Okay: the
article's name is "Friction Free Debuging with Proxies" it at:
http://www.java-pro.com/upload/free/features/javapro/2000/11nov00/jm0011/jm0
011.asp
It doen't use Log4j, but it's easy enough to alter. Take your time and read
it, it's not too difficult to follow. There are some caveats to using it
('this' pointer related) but nothing dreadful. (Except performance!)
Hope this helps
John Volkar
Senior Software Engineer II
E-Transport, a division of Descartes (DSGX)
[EMAIL PROTECTED]
-----Original Message-----
From: Alex Colic [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 22, 2001 9:18 AM
To: [EMAIL PROTECTED]
Subject: wrapper for Log4j for method entrance/exit?
Hi,
I am adding more debugging to my app. As my program runs I would like to
print to a file as it enters methods and exits them. I know that at the
beginning of the method and at the end I could do something like
log("Entered method: MyMethod()");
but that would be tedious.
Is there some time of wrapper class that I could pass the class to in a
constructor that as methods in the class are called, logging occurs?
Thanks for any help.
Alex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]