You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Paul Smith <ps...@aconex.com> on 2005/02/24 00:26:32 UTC
sub-classing logger - mark as final?
If we do not recommend sub-classing Logger, should we just mark it as
final? (or am I over simplfying things here?).
cheers,
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: sub-classing logger - mark as final?
Posted by Curt Arnold <ca...@apache.org>.
On Feb 23, 2005, at 7:07 PM, Paul Smith wrote:
> yes, it is pretty brutal. I thought if it was 'in the best
> interests' of the user we could consider it, but as I said, I don't
> really understand the use cases that may benefit from sub-classing
> Logger.
>
>
I've had several discussions with log4cxx users who have been insistent
to extend it in places that weren't designed for extension when they
could accomplish the same objectives using the places that were
designed for extension. The lack of a "final" on log4j seemed to
indicate to them that everything was open for extension and that I
should have made all (or most) of the functions virtual. I think Item
15 in "Effective Java" says it best, "design and document for extension
or else prohibit it". However it is always harder to take something
away.
I know that early Java compilers had problems with final member
variables that were initialized in constructors. I assumed that the
scarcity of final modifiers in log4j probably was due to that, but I
hope that is no longer an issue.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: sub-classing logger - mark as final?
Posted by Paul Smith <ps...@aconex.com>.
yes, it is pretty brutal. I thought if it was 'in the best interests'
of the user we could consider it, but as I said, I don't really
understand the use cases that may benefit from sub-classing Logger.
"Nothing to see here, move along now". :D
Paul
Yoav Shapira wrote:
>Hola,
>I don't think we should subclass it as final. That's a radical measure far
>beyond a recommendation, and we can't assume we know all the
>use-cases/scenarios under which people might want to subclass Logger.
>
>The above applies to most open-source code, especially utility-level stuff
>like log4j, not just the Logger class per-se ;)
>
>Yoav
>
>
>
>>-----Original Message-----
>>From: Paul Smith [mailto:psmith@aconex.com]
>>Sent: Wednesday, February 23, 2005 6:27 PM
>>To: log4j-dev@logging.apache.org
>>Subject: sub-classing logger - mark as final?
>>
>>If we do not recommend sub-classing Logger, should we just mark it as
>>final? (or am I over simplfying things here?).
>>
>>cheers,
>>
>>Paul
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-dev-help@logging.apache.org
>
>
>
>
RE: sub-classing logger - mark as final?
Posted by Yoav Shapira <yo...@MIT.EDU>.
Hola,
I don't think we should subclass it as final. That's a radical measure far
beyond a recommendation, and we can't assume we know all the
use-cases/scenarios under which people might want to subclass Logger.
The above applies to most open-source code, especially utility-level stuff
like log4j, not just the Logger class per-se ;)
Yoav
> -----Original Message-----
> From: Paul Smith [mailto:psmith@aconex.com]
> Sent: Wednesday, February 23, 2005 6:27 PM
> To: log4j-dev@logging.apache.org
> Subject: sub-classing logger - mark as final?
>
> If we do not recommend sub-classing Logger, should we just mark it as
> final? (or am I over simplfying things here?).
>
> cheers,
>
> Paul
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org