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

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


We certainly have relied on it up until now, but it looks like we can put the logic from our custom ContextSelector into an SLF4JServiceProvider.

Thanks for your help!

BR,

Richard
On 6/9/2023 2:04:04 PM, logback developers list via logback-dev <logback-dev at qos.ch> wrote:
Currently, ContextSelector is not used and is considered vestigial. It
can be reintroduced depending on user interest.

On 6/9/2023 7:59 PM, logback developers list via logback-dev wrote:
> Does that mean that ContextSelector will be removed entirely at some point?
>>
>> On 6/9/2023 1:51:45 PM, logback developers list via logback-dev
>> wrote:
>>
>>
>> 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
>> >> 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
>> _______________________________________________
>> logback-dev mailing list
>> logback-dev at qos.ch
>> https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-dev
> 653eb924-9acd-40d5-8a50-ec40d5128862
>
> _______________________________________________
> 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
_______________________________________________
logback-dev mailing list
logback-dev at qos.ch
https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-dev
[a636fbe9-aed4-45b7-b697-376e6da57e3b]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-dev/attachments/20230609/a3dc5f3b/attachment-0001.htm>


More information about the logback-dev mailing list