[slf4j-dev] Review of slf4j

Ceki Gülcü listid at qos.ch
Sun May 8 23:52:18 CEST 2005


At 23:38 5/8/2005, Ceki Gülcü wrote:
>At 07:34 5/7/2005, Niclas Hedhman wrote:
>>On Friday 06 May 2005 22:11, Ceki Gülcü wrote:
>> > How many pojo's are there that take a Logger in their constructor? Phrased
>> > differently, is it the job of the App framework to provide loggers to the
>> > objects that it instantiates?
>>
>>Yes, either in constructor or via some framework specific lookup mechanism.

Or injection through a setter method?

>>This is a fairly important aspect of IoC frameworks.
>>Effectively, the idea that each API provides its own discovery/lookup
>>mechanism is the (really low) underlying reason for the JCL issue, but also
>>many similar (but less frequent) ones.

I don't think the above statement is entirely true.

>>Ultimately, it leads to;
>>
>>  *  API provides a discovery/lookup mechanism.
>>  *  API is not allowed to do classloader management.
>>  *  API (with all its dependencies) will end up in some top level 
>> classloader.
>>  *  API extensions are not runtime deployable.
>>
>>If the API does not provide the discovery/lookup mechanism, and instead rely
>>on the Inversion-of-Control principles, that each object must be provided 
>>the
>>services it needs, then all of the above "goes away".
>>Unfortunately, not everyone program according to IoC, so I doubt it can be
>>made a rule to have Loggers provided to the components. BUT, if the 
>>component
>>must identify itself to the LoggerFactory, then the framework would have a
>>chance to figure things out.
>>
>>The Log4J principle that the object itself should manage where in the Logger
>>tree it should be placed, is IMHO a wacko idea, and I have so far not seen
>>any reasonable solution (other than the standard class hierarchy) how 
>>that is
>>managed.
>>
>>
>>ULogger logger = LoggerFactory.getInstance( this ).getLogger( subdomain );


Supplying the factory with the object requesting the logger is an 
interesting suggestion. As in,

   ULogger logger = LoggerFactory.getInstance(this);

This opens the door for new possibilities.


-- 
Ceki Gülcü

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





More information about the slf4j-dev mailing list