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: [NEWS] Component and ComponentBase
Date Fri, 07 Jan 2005 19:50:44 GMT
Which item is this in Effective Java?  He also makes a strong argument (Item
1) to use static factory methods instead of constructors.

I think that going down the constructor path can potentially lead to
"parameter madness" as you add more "required" members that must be set at
construction time.

Just a comment,
-Mark

> -----Original Message-----
> From: Ceki Gülcü [mailto:ceki@qos.ch]
> Sent: Friday, January 07, 2005 11:31 AM
> To: Log4J Developers List
> Subject: [NEWS] Component and ComponentBase
> 
> 
> Curt et al.,
> 
> I had a long technical dicussion with a friend who mentioned that in
> "Effective Java" Joshua Bloch makes a compelling case against the
> setter approach (and in favor of constructors).
> 
> The existing configuration code relies on Appenders, Layouts and
> Receivers having a default constructor. However, the Component
> interface and ComponentBase class do *not* prevent the use of
> constructors taking an LR as argument in other classes, in particular
> in the classes indirectly instanciated by Appenders, Layouts, etc.
> 
> He also suggested a simple solution to the "default repository
> configuration while in the context of 'myWebApp'" problem which
> triggered all the recent changes. Basically, he suggests that in the
> static initializer of LogManager the default repository be configured
> before the repositorySelector is instantiated. During the
> configuration of the default repository, the repositorySelector
> field has to temporarily point to a default RepositorySelector, not
> the real selector, not yet instantiated.
> 
> This fix may imply that we can go back to the old internal logging
> guidelines which only required instance Logger variables, without the
> need to change every single class that log4j used internally.
> 
> --
> Ceki Gülcü
> 
>    The complete log4j manual: http://www.qos.ch/log4j/
> 
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message