Howdy,
Who says Logger must be static?  As it already your implementation will
incur a performance penalty over the log4j native implementation, as
nearly all wrappers do.  Making Logger not static will only further
reduce the performance of your logging.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: wleana [mailto:[EMAIL PROTECTED]
>Sent: Thursday, April 03, 2003 4:05 AM
>To: [EMAIL PROTECTED]
>Subject: static/inherit problem
>
>Hi, I have a design issue related to the fact that the Logger needs
>to be static. And suppose I have A and its subclass B.
>
>I have a wrapper MyLog that wraps around Logger and a myId field of
>each class, in which, the log message always print out myId of its
>caller.
>
>class A {
>private static MyLog mLog;
>protected myId;
>A(){
>  myId = "A";
>  init myLog with myId...
>}
>
>public void doSth(String aMsg){
>   mLog.debug(aMsg);
>}
>}
>
>class B extends A{
>B(){
> myId = "B";
> super()
> }
>}
>
>When I do this:
>B b=new B();
>b.doSth("blah");
>
>The log will actually show the caller's myId is "A", instead of "B".
>(you see I even make the myId field non-static because of the same
>issue, but actually I would like it to be static conceptually)
>
>I have tried different ways, it only works if mLog is not static, the
>within doSth from class A, it will actually dynamically use object of
>type B's mLog...But we want the Logger class (or its wrapper class)
>to belong to class not to an object...how should we solve this? What
>should be the right design of this? Please share your thoughts.
>
>Thanks a lot.
>-wleana
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to