[slf4j-dev] StaticMDCBinder but not IMDCFactory
Ceki Gulcu
ceki at qos.ch
Fri Mar 13 09:32:39 CET 2009
I agree. It's an omission. Could you please create a bugzilla entry
for this item?
The change in contract which happened in the 1.5.x series created a
lot of icky problems downstream. See for instance [1]. I do not wish
to introduce the same type of problems for the sake of
elegance. Perhaps by adding a getMDCAdapter method in StaticMDCBinder
but leaving the SINGLETON field as static public (instead of
private). This should guarantee both forward and backward
compatibility and more (but not 100%) consistent code.
Thank you in advance for creating the bugzilla entry.
[1] http://slf4j.org/faq.html#IllegalAccessError
Gunnar Wagenknecht wrote:
> Ceki Gulcu schrieb:
>> Hello Gunnar,
>>
>> MDC is by construction a class with static methods. I fail to see how
>> IMDCFactory could be made to create a fixed and static class. It just
>> does not make sense. Have you noticed the MDCAdapter interface?
>
> Sorry, I might not have been clear enough.
>
> StaticMDCBinder uses a public static final field SINGLETON.
> StaticLoggerBinder and StaticMarkerBinder use a public static method
> getSingleton().
>
> StaticLoggerBinder and StaticMarkerBinder implements and interface which
> defines a contract for the public getter.
> StaticMDCBinder does not.
>
> I was wondering if the programming pattern should be the same in
> StaticMDCBinder to make adoption easier and to have a contract for the
> getMDCA and getMDCAdapterClassStr methods as we have for
> StaticLoggerBinder and StaticMarkerBinder.
>
> -Gunnar
>
--
Ceki Gülcü
Logback: The reliable, generic, fast and flexible logging framework for Java.
http://logback.qos.ch
More information about the slf4j-dev
mailing list