Hello Mike,


This question is answered in some detail in "The complete log4j
manual. If my memory serves me right, you have already ordered this
book.

To gist of the answer is that once a logger is created it is bound to
the hierarchy. If a logger of name 'foo' and type X is created, it
cannot be retrieved by the same name *and* a different type. Such
attempts result in ClassCastExceptions.

Wrappers do not suffer from this problem.

If you are sure that the logger hierarchy is totally under your
control, then sub-classing is OK. However, if your code runs in an
application server or a servlet container, then your code might break
in future versions of log4j or the app server or the servlet
container.

HTH,

At 10:50 AM 6/11/2003 -0400, you wrote:



I receive regular questions from internal customers asking why it is
recommended to wrap Log4j through aggregation as opposed to inheritance.

I am familiar with the ClassCastException issue found in
http://jakarta.apache.org/log4j/docs/TROUBLESHOOT.html#cce.
I have purchased the Log4j Full Manual, and will search for information in
this regard.  I've noted there is a section in the book covering wrapping
Log4j.

In addition, would someone please comment on the technical reasons
aggregation is recommended, as opposed to sub-classing?

Thanks for your time.

Mike

--
Ceki For log4j documentation consider "The complete log4j manual"
ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp



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



Reply via email to