[slf4j-dev] SLF4J Implementation for Simple Log

Ceki Gülcü listid at qos.ch
Wed Aug 10 18:20:25 CEST 2005


At 02:51 PM 8/10/2005, Graham Lea wrote:

>Name changes don't really bother me, but I don't really like single-letter 
>prefixes in class/interface names. (That's a personal preference.)

Agreed. LoggerFactory would be a better name but its already taken.

>I think it's misleading in this case because LoggerFactory doesn't 
>implement ILoggerFactory, which might throw a lot of people.

Quite true. The fact that LoggerFactory (offering only static methods) does 
not implement ILoggerFactory is not really nice but that seems more like an 
unavoidable language constraint.

>(I think EJB people are used to having the interface prefixed with 'I' and 
>the implementation being the same name without the 'I'?)

Yes, that is often the case.

>It's all very hard, though, because the terms being used here - 'Factory' 
>and 'Adapter' - are very loaded, and people have certain expectations of 
>classes that have these names.
>I faced the same problem when I wrote 
><http://home.exetel.com.au/grlea/projects/log-bridge/api/org/grlea/logBridge/package-summary.html>Log 
>Bridge and ended up calling the LoggerFactory equivalent there 
>'LogBridgeManager'.
>
>I think the interface now called ILoggerFactory really is an adapter for 
>the logger factory, so LoggerFactoryAdapter would probably be my preference.

That is what I thought as well, hence initial name LoggerAdapterFactory. 
However, in future SLF4J incarnations it might be possible for 
ILoggerFactory to manufacture Logger instances of *distinct* types. In 
other words, a certain ILoggerFactory may act as a multiplexer for 
different child ILoggerFactory instances.

>I tend to prefer clarity over brevity, where practical.

Absolutely.

>Seeing as it should only be SLF4J implementers who are implementing the 
>interface, I wouldn't consider brevity to be warranted in this situation.

Agreed. Based on these same arguments, given that for native SLF4J 
implementations there is no adaptation to do, ILoggerFactory is what the 
name suggests: an interface to be implemented by objects manufacturing 
Logger instances. The type of the manufactured instances being left to the 
discretion of the factory object.

>In the end, though, I'm not really that concerned what it's called, as 
>long as the javadoc makes it really clear what it is.
>Another option you could consider would be making ILoggerFactory an 
>inner-interface of LoggerFactory called simply 'Adapter'.

One of the motivations for ILoggerFactory is to allow IoC frameworks to 
take over the logging environment. I say hopefully because this is yet to 
happen.

-- 
Ceki Gülcü

   The complete log4j manual: http://www.qos.ch/log4j/





More information about the slf4j-dev mailing list