I don't understand why there's a debate.

Ceki recommends wrapping in his book, particularly for avoiding the
ClastCastExceptions that can result from extending Log4j. (also see
http://logging.apache.org/log4j/docs/TROUBLESHOOT.html)  Although the
problem can be somewhat avoided by the factory property, it doesn't solve
the problem if two are needed in the same app (or process space).  He states
clearly in his book that "extending logger is inherently unsafe".

Also, from a maintainability perspective wrapping (black box reuse) is
better than inheritance (white box reuse), generally speaking.  Effective
Java Item 14 makes this point - prefer composition over inheritance.

Maybe I missed something in an earlier email, I caught on to this a little
late.  If that's the case my apologies.

Mike



-----Original Message-----
From: Endre St�lsvik [mailto:[EMAIL PROTECTED]
Sent: Friday, April 23, 2004 10:38 AM
To: Log4J Users List
Subject: Re: Which Way of "Extending" Gives Fastest Performance


On Fri, 23 Apr 2004, Denis Haskin wrote:

| This conversation seems to have focused more on the checking of the
| boolean, which wasn't my original point.
|
| The issue I was raising was just to be aware of the potential cost of
| assembling the parameters for the debug() call, particularly because you
| will bear that cost even if debug logging is disabled (that is, if you
| don't wrap the debug() call in the conditional).

Not wrapping it in the conditional would be insane, granted. But that's
the sole reason for the isDebugEnabled(), and it is covered a bunch of
places in the log4j tutorials.

The original point, wrapping or extending, is interesting, though, and
Robert Pepersack haven't really gotten any answers yet! I don't know..

Endre



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

-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions
USA, Inc. and are intended only for the addressee(s). 
The information contained herein may include trade secrets or privileged or
otherwise confidential information.  Unauthorized review, forwarding, printing,
copying, distributing, or using such information is strictly prohibited and may
be unlawful.  If you received this message in error, or have reason to believe
you are not authorized to receive it, please promptly delete this message and
notify the sender by e-mail with a copy to [EMAIL PROTECTED]

Thank you

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

Reply via email to