On 4/5/02 6:37 PM, "Geir Magnusson Jr." <[EMAIL PROTECTED]> wrote:

> 
> So the LogFactory itself isn't really generic, as it presumes the helper?
> And everyone who writes to this does
> 
> import o.a.c.l.LogFactory;
> 
> ...
> 
> Log logger = LogFactory.getLogger();
> 
> 
> Ok - so there's no point in continuing.  It seems like the only way to offer
> a generic set of interfaces for logging is to do a different package...
> 


Wouldn't a better pattern be the discovery pattern in the services docs :

 import o.a.c.l.LogFactory;

  public class MyFoo {

     Log logger = null;

     static {

       Iterator i = Service.providers(LogFactory.class);

       while (i.hasNext())
       { 
           LogFactory lf = (LogFactory) i.next();
           logger = lf.getLogger(....);
       }
     } 

    public void foo()
    {
      logger.log("hi from foo");
    }
  }

Question - could o.a.c.l.LogFactory be an interface in this case?  I am
guessing yes, but not sure...

So in this case, the pull discovery is maintained ("Not taken away...") yet
implementation freedom is restored...

-- 
Geir Magnusson Jr.                                     [EMAIL PROTECTED]
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


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

Reply via email to