GitHub user Vampire opened a pull request:

    https://github.com/apache/logging-log4j2/pull/175

    Make java.util.ServiceLoader properly work in OSGi by using the Service 
Loader Mediator Specification

    slf4j needs a similar change I propsed as PR in 
https://github.com/qos-ch/slf4j/pull/198,
    but by using a fragment that gap can be taken care of.
    
    As a workaround one can create a fragment like the one for the slf4j-api 
bundle propsed in the other PR, e. g. with Gradle using
    
    ```groovy
    plugins {
        id 'osgi'
    }
    
    task log4jSlf4jImplFragmentJar(type: Jar) {
        baseName = project.name + '-log4jSlf4jImplFragment'
        manifest = osgiManifest {
            name = 'net.kautler.test.osgi.log4j.slf4j.impl.fragment'
            symbolicName = 'net.kautler.test.osgi.log4j.slf4j.impl.fragment'
            version = '1.0.0'
            classesDir = temporaryDir
            classpath = files()
            instruction 'Fragment-Host', 'org.apache.logging.log4j.slf4j-impl'
            instruction 'Require-Capability', '' +
                    'osgi.extender;' +
                    'filter:="(osgi.extender=osgi.serviceloader.registrar)"'
            instruction 'Provide-Capability', '' +
                    'osgi.serviceloader;' +
                    'osgi.serviceloader=org.slf4j.spi.SLF4JServiceProvider'
        }
    }
    ```

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/Vampire/logging-log4j2 serviceloader-in-osgi

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/logging-log4j2/pull/175.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #175
    
----
commit c5e0f2625054d0a9eaa5811450513239ac831af2
Author: Björn Kautler <bjoern@...>
Date:   2018-05-18T13:54:17Z

    Make java.util.ServiceLoader properly work in OSGi by using the Service 
Loader Mediator Specification

----


---

Reply via email to