[slf4j-user] how to properly activate the jul-to-slf4j bridge
Ceki Gülcü
ceki at qos.ch
Sun Sep 17 08:52:20 CEST 2023
On 9/17/2023 8:09 AM, Shawn Heisey via slf4j-user wrote:
> On 9/16/2023 3:36 PM, Ceki Gülcü via slf4j-user wrote:
>>> I have learned that although Solr does include the jul-to-slf4j
>>> jar, this bridge does not get activated just by having the jar in
>>> the classpath. It must be activated either in the code or in the
>>> JUL config.
>>
>> That is correct.
>
> How do I do this successfully? Is it enough to install the
> SLF4JBridgeHandler once at program startup?
Yes.
> I had expected that if I had done it correctly, then the Lucene loggers
> would have been propagated to slf4j and then to log4j. Solr's loggers
> (created directly with slf4j) do appear in log4j. But the Lucene
> loggers aren't showing up, which means that either my expectation is
> wrong or I didn't activate the bridge properly.
Installing SLF4JBridgeHandler ensures that log events are propagated
from JUL to SLF4J (and then to the SLF4J logging provider).
However, both JUL and SLF4J provider will perform level filtering on
their own *independently*. To log an event, you need to make sure that
the event passes both the JUL filters and the SLF4J provider's filters.
I hope this helps,
--
Ceki Gülcü
Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch
More information about the slf4j-user
mailing list