[logback-dev] what replaced StaticLoggerBinder to invoke ContextSelectorStaticBinder.init()?

logback developers list logback-dev at qos.ch
Fri Jun 9 19:51:20 CEST 2023


During 1.3 development, there was a simplification effort and support
for context selectors was dropped due to lack of interest.

Having said this, you can create your own implementation of
SLF4JServiceProvider overriding LogbackServiceProvider.


On 6/9/2023 7:27 PM, logback developers list via logback-dev wrote:
> Yeah my issue is that I have a unit test that checks if
> ContextSelectorStaticBinder is properly configured to return our custom
> ContextSelector and I'm not sure what to replace that with.
> 
>         ContextSelector selector =
> ContextSelectorStaticBinder.getSingleton().getContextSelector();
>         assertTrue(selector instanceof FrameworkLoggerContextSelector);
> 
> getContextSelector() now returns null in my unit test.
> 
> BR,
> 
> Richard
>>
>> On 6/9/2023 1:07:26 PM, logback developers list via logback-dev
>> <logback-dev at qos.ch> wrote:
>>
>>
>> Hello Richard,
>>
>> StaticLoggerBinder has been replaced by
>> org.slf4j.spi.SLF4JServiceProvider of which LogbackServiceProvider is an
>> implementation.
>>
>> SLF4JServiceProvider interface has a method called initialize().
>>
>> Is this what you were asking?
>>
>> -- 
>> Ceki Gülcü
>>
>> Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch
>>
>> On 6/9/2023 7:01 PM, logback developers list via logback-dev wrote:
>> > Before 1.3, the class StaticLoggerBinder had an init method that would
>> > in turn call the init method on the singleton ContextSelectorBinder:
>> >
>> > contextSelectorBinder.init(defaultLoggerContext, KEY);
>> >
>> > -Richard
>> > 48c29399-04ec-4cd1-8794-c7507a7d5ded
>> _______________________________________________
>> logback-dev mailing list
>> logback-dev at qos.ch
>> https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-dev
> 17fa5a94-06c8-464e-bde9-1843e17d88e4
> 
> _______________________________________________
> logback-dev mailing list
> logback-dev at qos.ch
> https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-dev

-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch


More information about the logback-dev mailing list