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 ve...@belgacom.be on 2002/10/16 13:03:50 UTC

Log4J 1.2.7

Hi,

I would like to understand why since Log4J 1.2.7 "you" discourage people to subclass the Logger class?
What about the following document http://jakarta.apache.org/log4j/docs/deepExtension.html which explain how to systematically extend log4J?

What should I do if I want to log more "levels" than the one provided by Log4J?

Cheers,
Veton.

**** DISCLAIMER **** 
"This e-mail and any attachments thereto may contain information 
which is confidential and/or protected by intellectual property 
rights and are intended for the sole use of the recipient(s) named above. 
Any use of the information contained herein (including, but not limited to, 
total or partial reproduction, communication or distribution in any form) 
by persons other than the designated recipient(s) is prohibited. 
If you have received this e-mail in error, please notify the sender either 
by telephone or by e-mail and delete the material from any computer. 
Thank you for your cooperation."


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Log4J 1.2.7

Posted by Ceki Gülcü <ce...@qos.ch>.
At 13:03 16.10.2002 +0200, you wrote:
>Hi,
>
>I would like to understand why since Log4J 1.2.7 "you" discourage people 
>to subclass the Logger class?
>What about the following document 
>http://jakarta.apache.org/log4j/docs/deepExtension.html which explain how 
>to systematically extend log4J?


The deepExtension.html link has been removed.

When you subclass Logger and add new methods you assume that you have
control over the type of Logger that will be returned by
Logger.getLogger(). In reality, you do not. Actually, there is a high
risk of getting a ClassCastException at runtime with devastating
results.

If you want to add a new level, then you should wrap the Logger class
not subclass it.

>What should I do if I want to log more "levels" than the one provided by 
>Log4J?
>
>Cheers,
>Veton.


--
Ceki

TCP implementations will follow a general principle of robustness: be
conservative in what you do, be liberal in what you accept from
others. -- Jon Postel, RFC 793



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>