On Fri, 5 Apr 2002, Geir Magnusson Jr. wrote:

> > Replace it with what ? The javadoc for the static LogFactory.getLog()
> > is pretty clear, the method must implement what's in the doc.
> > 
> 
> My own implementation?  (You know, that choice thing?)

So you're saying an API can never use static methods ? 

It's just a simple tradeoff between convenience and flexibility. 
If we don't have the static method the user will have to write more
code. 

Even if you would be able to replace it, the replacement is required 
to implement exactly the same thing anyway.


> 1) if the Log, LogFactory interfaces are kept in the same jar the
> .impl.LogFactory, then "there are challenges" to clearly implement an
> alternative LogFactory because of the issues surrounding the discovery
> method.  

No. The discovery method works the way it is supposed to - i.e. it _helps_ 
you if you have a single logger implementation and prefer to be helped.

If you have more then one or you don't like the discovery - just use 
whatever else you want, the static method in LogFactory is just supposed
to make 'simple things easy'.

> 2) If Log and LogFactory interfaces were separated from the .impl that is in
> commons now, into two separate packages,
> 
>     o.a.c.l -> commons-logging.jar (contains the interfaces)
>     
>     o.a.c.li -> commons-loggingimpl.jar (contains the impl)
> 
> then 
> 
> 
>   b) Alternative LogFactory implementations are easy to deploy as it just
> means dropping the lightweight interface jar into the classpath, and the
> alternative factory impl jar.

It doesn't matter where the LogFactory sits - if we define the helper 
( org.apache.foo.LogFactory ) and it uses a static method it can't be
reimplemented.

If you sugest replacing the actual class - you can do it today by 
replacing the class in the current jar.


>   c) o.a.c.l becomes a truly generic logging interface (which is how many
> people interpret it) that can be implemented by anyone, supporting any pull
> model you choose, and any push model you choose...

o.a.c.l is a 'generic logging interface' already - it is not a 'generic 
discovery interface'. The pull/push/Class.forName()/static methods 
are all choices on how to register and get a logger - including the 
infamous static method you don't like. It's a choice that work
if you have a single logger and you use the standard mechanism, same
as JAXP.

Costin


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to