On Fri, 17 Aug 2001 10:02, Morgan Delagrange wrote:
> How do you propose avoiding NullPointerExceptions?  If it's in the
> interface, it has to be supported or degrade gracefully.  A method that may
> or may not return a Log object does not degrade.

I will post the example again. 

//Syslog example where no hierarchy is directly supported by API
return new SyslogLogImpl( currentCategory + "." + subCategory );

All you do is create a new catgeory name in a flat namespace rather than 
hierarchial. getChildLog() would never return null.

If you don't have this then your application as a whole is still going to 
need to be bound to a specific logging toolkit. If you have it then you can 
pass you root logger to main object. It will then call getChildLogger() to 
create Loggers for any components it creates. 

Doing it this way means that general use of logging is toolkit independent. 
The only thing that is toolkit specific is creation of first Logger. And this 
could be hidden away by a factory if you wanted. So much like JAXP/JNDI et al 
you could simply drop a different jar into classpath to change logging 
toolkits. 

-- 
Cheers,

Pete

*-----------------------------------------------------*
* "Faced with the choice between changing one's mind, *
* and proving that there is no need to do so - almost *
* everyone gets busy on the proof."                   *
*              - John Kenneth Galbraith               *
*-----------------------------------------------------*

Reply via email to