logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ceki Gülcü <c...@qos.ch>
Subject Re: Log4J 1.2.7
Date Wed, 16 Oct 2002 11:35:20 GMT
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:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message