logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Womack <wom...@adobe.com>
Subject RE: [POLL] Component and ComponentBase
Date Wed, 05 Jan 2005 01:54:42 GMT
> No, log4j objects will not be referenced as Component. It is not a
> marker interface either.
> The requirement to have both Component as an interface and
> ComponentBase as a class, stems from the fact that we make the
> distinction between Appender the interface and AppenderSkeleton the
> class. Implementations of Appender derive from AppenderSkeleton but
> all the other code in log4j refers to Appender and is oblivious to the
> existence of AppenderSkeleton.

And that makes sense because you want the outside world to deal with
Appender, not AppenderSkeleton.  AppenderSkeleton has implementation methods
that are specific to it.  I get it.  But if we will never reference
Components and it is not a marker interface, why have an interface at all?
Why not just implement ComponentBase with the functionality and have all the
log4j implementation just inherit from that base class?  What purpose is the
Component interface serving here?

Let's approach it a different way.  If I am a developer, and I implement my
own appender class that implements the Appender interface, will we (the
framework) care if I implement setLoggerRepository?  Will parts of the
framework expect to find this method or crash otherwise?  If yes, then an
interface makes sense here.  If no, then I don't see what purpose the
interface really serves; ComponentBase is providing useful but not required
functionality for internal logging.

I am guessing that we are making setLoggerRepository a required method for
appenders given that you have Appender extending Component.  How have
appenders survived this long without knowing about their owning repository?
Besides internal logging (which one might argue, external developers should
not have to be concerned about), what benefit does this have for appenders?

That interface change is going to have much larger effect than the change to
the Configurator interface.  Almost no one writes their own configurator,
but at some point almost everyone writes their own appender.  Unless they
subclass AppenderSkeleton, they will need to modify their appender code.


To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org

View raw message