[
https://issues.apache.org/jira/browse/LOG4J2-2305?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16532540#comment-16532540
]
Björn Kautler commented on LOG4J2-2305:
---------------------------------------
[[email protected]] I'm not sure merging my PR was a good idea.
When {{log4j-slf4j-impl}} depended on 1.8 anyway, 1.8 would have been there and
in its current state needs the service loader mediator to work properly.
Except of course someone excluded slf4j 1.8 and used 1.7 instead.
Now that {{log4j-slf4j-impl}} has slf4j 1.8 only as provided dependency, it is
more likely that one has 1.7 which is the stable version.
For that, the service loader mediator is not necessary, but with my PR, now the
service loader mediator is required to be provided by the consumer, providing
for example {{org.apache.aries.spifly:org.apache.aries.spifly.dynamic.bundle}}
at runtime.
I think you should revert my commit until 1.8 has settled down and it is
finally clear how it has to be done.
If they stay with the Java service loader mechanism for the final release, you
probably need the mediator.
An alternative would be to split {{log4j-slf4j-impl}} into {{log4j-slf4j-impl}}
and {{log4j-slf4j18-impl}}, where only the latter has the service loader
mediator as dependency and the former not, but only the latter would work with
1.8.
> Log4j 2.10+not working with SLF4J 1.8 in OSGI environment
> ---------------------------------------------------------
>
> Key: LOG4J2-2305
> URL: https://issues.apache.org/jira/browse/LOG4J2-2305
> Project: Log4j 2
> Issue Type: Bug
> Affects Versions: 2.10.0, 2.11.0
> Reporter: Rob Gansevles
> Priority: Major
> Fix For: 2.11.1
>
>
> I have a simple osgi plugin that just logs something to slf4j Logger in the
> Activator's bundle start method.
> When I install and start log4j-core-2.11.0.jar, log4j-api-2.11.0.jar,
> log4j-slf4j-impl-2.11.0.jar and slf4j-api-1.8.0-beta1.jar in a clean felix
> gogo shell, and then install and start my plugin, it prints the
> No-SLF4J-providers-were-found message.
>
>
> It does work if I do the same with log4j 2.9.1 and slf4j-api-1.7.25.
>
> You can find my simple plugin on github:
> [https://github.com/rgansevles/osgi-slf4j-sample]
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)