Sling
  1. Sling
  2. SLING-3243

Update the Slf4j API bundle to 1.7.5

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: Launchpad Builder 7
    • Component/s: None
    • Labels:
      None

      Description

      We should update the Slf4j API bundle and other slf4j bundle to there latest release of 1.7.5 [1].

      One problem with Slf4j is that it exports package with version matching the jar version. So with 1.7.5 the packages are also exported at 1.7.5. So it might pose problem for bundle which import with smaller range like [1.6.0,1.7)

      See http://markmail.org/thread/vu4uoiln4z4f3mms

        Activity

        Hide
        Chetan Mehrotra added a comment -

        Checking for the Import-Package directives of various bundles in Sling using [1] yields following result

        Bundle Name Package Name Version
        org.apache.sling.settings org.slf4j [1.5,2)
        org.apache.sling.installer.core org.slf4j [1.5,2)
        jcl.over.slf4j org.slf4j 1.6.4
        jcl.over.slf4j org.slf4j.spi 1.6.4
        org.apache.sling.launchpad.installer org.slf4j [1.5,2)
        slf4j.api org.slf4j.impl 1.6.0
        org.apache.sling.commons.logservice org.slf4j [1.5,2)
        log4j.over.slf4j org.slf4j 1.6.0
        log4j.over.slf4j org.slf4j.helpers 1.6.0
        log4j.over.slf4j org.slf4j.spi 1.6.0
        org.apache.sling.commons.log org.slf4j [1.6,1.7)
        org.apache.sling.commons.log org.slf4j.spi [1.6,1.7)
        org.apache.sling.commons.log org.slf4j.helpers [1.6,2)
        org.apache.sling.installer.provider.file org.slf4j 1.5
        org.apache.sling.javax.activation org.slf4j [1.5,2)
        org.apache.felix.http.jetty org.slf4j null
        org.apache.aries.jmx.whiteboard org.slf4j [1.5,2)
        org.apache.sling.extensions.threaddump org.slf4j 1.5
        org.apache.sling.extensions.webconsolesecurityprovider org.slf4j 1.5
        org.apache.tika.bundle org.slf4j null
        org.apache.sling.jcr.jackrabbit.server org.slf4j [1.5,2)
        org.apache.jackrabbit.oak-core org.slf4j [1.6,2)
        org.apache.jackrabbit.oak-lucene org.slf4j [1.6,2)
        org.apache.jackrabbit.oak-mk org.slf4j [1.6,2)
        org.apache.sling.jcr.oak.server org.slf4j [1.5,2)
        org.apache.jackrabbit.jackrabbit-jcr-rmi org.slf4j [1.6,2)
        org.apache.jackrabbit.jackrabbit-spi-commons org.slf4j [1.6,2)
        org.apache.jackrabbit.jackrabbit-webdav org.slf4j [1.6,2)
        org.apache.sling.jcr.base org.slf4j [1.5,2)
        org.apache.sling.jcr.davex org.slf4j [1.5,2)
        org.apache.sling.jcr.jackrabbit.accessmanager org.slf4j [1.5,2)
        org.apache.sling.jcr.jackrabbit.usermanager org.slf4j [1.5,2)
        org.apache.sling.jcr.registration org.slf4j [1.5,2)
        org.apache.sling.jcr.webdav org.slf4j [1.5,2)
        org.apache.sling.adapter org.slf4j [1.5,2)
        org.apache.sling.api org.slf4j [1.5,2)
        org.apache.sling.auth.core org.slf4j [1.5,2)
        org.apache.sling.auth.form org.slf4j [1.5,2)
        org.apache.sling.auth.openid org.slf4j [1.5,2)
        org.apache.sling.auth.selector org.slf4j [1.5,2)
        org.apache.sling.bundleresource.impl org.slf4j [1.5,2)
        org.apache.sling.commons.classloader org.slf4j 1.5
        org.apache.sling.commons.scheduler org.slf4j [1.5,2)
        org.apache.sling.commons.threads org.slf4j [1.5,2)
        org.apache.sling.discovery.impl org.slf4j [1.5,2)
        org.apache.sling.engine org.slf4j [1.5,2)
        org.apache.sling.event org.slf4j [1.5,2)
        org.apache.sling.fsresource org.slf4j [1.5,2)
        org.apache.sling.installer.factory.configuration org.slf4j [1.5,2)
        org.apache.sling.installer.provider.jcr org.slf4j [1.5,2)
        org.apache.sling.jcr.classloader org.slf4j [1.5,2)
        org.apache.sling.jcr.contentloader org.slf4j [1.5,2)
        org.apache.sling.jcr.ocm org.slf4j null
        org.apache.sling.jcr.resource org.slf4j [1.5,2)
        org.apache.sling.resourceresolver org.slf4j [1.5,2)
        org.apache.sling.scripting.core org.slf4j [1.5,2)
        org.apache.sling.scripting.javascript org.slf4j 1.5
        org.apache.sling.scripting.jsp org.slf4j [1.5,2)
        org.apache.sling.scripting.jsp.taglib org.slf4j [1.5,2)
        org.apache.sling.serviceusermapper org.slf4j [1.5,2)
        org.apache.sling.servlets.get org.slf4j [1.5,2)
        org.apache.sling.servlets.post org.slf4j [1.5,2)
        org.apache.sling.servlets.resolver org.slf4j [1.5,2)

        [1] https://gist.github.com/chetanmeh/3748614#file-checkbundleforheader-groovy

        Show
        Chetan Mehrotra added a comment - Checking for the Import-Package directives of various bundles in Sling using [1] yields following result Bundle Name Package Name Version org.apache.sling.settings org.slf4j [1.5,2) org.apache.sling.installer.core org.slf4j [1.5,2) jcl.over.slf4j org.slf4j 1.6.4 jcl.over.slf4j org.slf4j.spi 1.6.4 org.apache.sling.launchpad.installer org.slf4j [1.5,2) slf4j.api org.slf4j.impl 1.6.0 org.apache.sling.commons.logservice org.slf4j [1.5,2) log4j.over.slf4j org.slf4j 1.6.0 log4j.over.slf4j org.slf4j.helpers 1.6.0 log4j.over.slf4j org.slf4j.spi 1.6.0 org.apache.sling.commons.log org.slf4j [1.6,1.7) org.apache.sling.commons.log org.slf4j.spi [1.6,1.7) org.apache.sling.commons.log org.slf4j.helpers [1.6,2) org.apache.sling.installer.provider.file org.slf4j 1.5 org.apache.sling.javax.activation org.slf4j [1.5,2) org.apache.felix.http.jetty org.slf4j null org.apache.aries.jmx.whiteboard org.slf4j [1.5,2) org.apache.sling.extensions.threaddump org.slf4j 1.5 org.apache.sling.extensions.webconsolesecurityprovider org.slf4j 1.5 org.apache.tika.bundle org.slf4j null org.apache.sling.jcr.jackrabbit.server org.slf4j [1.5,2) org.apache.jackrabbit.oak-core org.slf4j [1.6,2) org.apache.jackrabbit.oak-lucene org.slf4j [1.6,2) org.apache.jackrabbit.oak-mk org.slf4j [1.6,2) org.apache.sling.jcr.oak.server org.slf4j [1.5,2) org.apache.jackrabbit.jackrabbit-jcr-rmi org.slf4j [1.6,2) org.apache.jackrabbit.jackrabbit-spi-commons org.slf4j [1.6,2) org.apache.jackrabbit.jackrabbit-webdav org.slf4j [1.6,2) org.apache.sling.jcr.base org.slf4j [1.5,2) org.apache.sling.jcr.davex org.slf4j [1.5,2) org.apache.sling.jcr.jackrabbit.accessmanager org.slf4j [1.5,2) org.apache.sling.jcr.jackrabbit.usermanager org.slf4j [1.5,2) org.apache.sling.jcr.registration org.slf4j [1.5,2) org.apache.sling.jcr.webdav org.slf4j [1.5,2) org.apache.sling.adapter org.slf4j [1.5,2) org.apache.sling.api org.slf4j [1.5,2) org.apache.sling.auth.core org.slf4j [1.5,2) org.apache.sling.auth.form org.slf4j [1.5,2) org.apache.sling.auth.openid org.slf4j [1.5,2) org.apache.sling.auth.selector org.slf4j [1.5,2) org.apache.sling.bundleresource.impl org.slf4j [1.5,2) org.apache.sling.commons.classloader org.slf4j 1.5 org.apache.sling.commons.scheduler org.slf4j [1.5,2) org.apache.sling.commons.threads org.slf4j [1.5,2) org.apache.sling.discovery.impl org.slf4j [1.5,2) org.apache.sling.engine org.slf4j [1.5,2) org.apache.sling.event org.slf4j [1.5,2) org.apache.sling.fsresource org.slf4j [1.5,2) org.apache.sling.installer.factory.configuration org.slf4j [1.5,2) org.apache.sling.installer.provider.jcr org.slf4j [1.5,2) org.apache.sling.jcr.classloader org.slf4j [1.5,2) org.apache.sling.jcr.contentloader org.slf4j [1.5,2) org.apache.sling.jcr.ocm org.slf4j null org.apache.sling.jcr.resource org.slf4j [1.5,2) org.apache.sling.resourceresolver org.slf4j [1.5,2) org.apache.sling.scripting.core org.slf4j [1.5,2) org.apache.sling.scripting.javascript org.slf4j 1.5 org.apache.sling.scripting.jsp org.slf4j [1.5,2) org.apache.sling.scripting.jsp.taglib org.slf4j [1.5,2) org.apache.sling.serviceusermapper org.slf4j [1.5,2) org.apache.sling.servlets.get org.slf4j [1.5,2) org.apache.sling.servlets.post org.slf4j [1.5,2) org.apache.sling.servlets.resolver org.slf4j [1.5,2) [1] https://gist.github.com/chetanmeh/3748614#file-checkbundleforheader-groovy
        Hide
        Chetan Mehrotra added a comment -

        Based on above we need to take care of following bundle

        Update to 1.7.5 release from Slf4j distribution

        • jcl.over.slf4j -
        • slf4j.api
        • log4j.over.slf4j

        Fix the package import directive

        • org.apache.sling.commons.log
        Show
        Chetan Mehrotra added a comment - Based on above we need to take care of following bundle Update to 1.7.5 release from Slf4j distribution jcl.over.slf4j - slf4j.api log4j.over.slf4j Fix the package import directive org.apache.sling.commons.log
        Hide
        Chetan Mehrotra added a comment - - edited

        Did the required changes in rev 1541534 and 1541535. The common.log imports org.slf4j packages in version range [1.6,1.8)

        All testcase seem to pass

        Tests run: 512, Failures: 1, Errors: 0, Skipped: 0

        Show
        Chetan Mehrotra added a comment - - edited Did the required changes in rev 1541534 and 1541535. The common.log imports org.slf4j packages in version range [1.6,1.8) All testcase seem to pass Tests run: 512, Failures: 1, Errors: 0, Skipped: 0
        Hide
        Chetan Mehrotra added a comment - - edited

        For bundle which wish to use the slf4j api 1.7.5 and make use of new var args support and still be usable on Sling systems which packages older version of Slf4j API jar say 1.6.4 they can do so by following steps

        1. Update the api version in pom dependency

          <dependencies>
            <dependency>
              <groupId>org.slf4j</groupId>
              <artifactId>slf4j-api</artifactId>
              <version>1.7.5</version>
              <scope>provided</scope>
            </dependency>
           ...
        </dependency>
        

        2. Add Import-Package instruction

        <build>
            <plugins>
              <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                  <instructions>
                    ...
                    <Import-Package>
                      org.slf4j;version="[1.5,2)",
                      *
                    </Import-Package>
                  </instructions>
                </configuration>
              </plugin>
              ...
           </plugins>
        </build>
        

        Above setup supports following things

        1. Slf4j API bundle 1.7.x is binary compatible with 1.6.x.
        2. It allows bundle to make use of var args feature while making logging calls
        3. Bundle can still be deployed on older system which package 1.6.4 version of slf4j api
        Show
        Chetan Mehrotra added a comment - - edited For bundle which wish to use the slf4j api 1.7.5 and make use of new var args support and still be usable on Sling systems which packages older version of Slf4j API jar say 1.6.4 they can do so by following steps 1. Update the api version in pom dependency <dependencies> <dependency> <groupId> org.slf4j </groupId> <artifactId> slf4j-api </artifactId> <version> 1.7.5 </version> <scope> provided </scope> </dependency> ... </dependency> 2. Add Import-Package instruction <build> <plugins> <plugin> <groupId> org.apache.felix </groupId> <artifactId> maven-bundle-plugin </artifactId> <extensions> true </extensions> <configuration> <instructions> ... <Import-Package> org.slf4j;version= "[1.5,2)" , * </Import-Package> </instructions> </configuration> </plugin> ... </plugins> </build> Above setup supports following things Slf4j API bundle 1.7.x is binary compatible with 1.6.x. It allows bundle to make use of var args feature while making logging calls Bundle can still be deployed on older system which package 1.6.4 version of slf4j api
        Hide
        Chetan Mehrotra added a comment -

        Update the Logging document with above information at http://sling.apache.org/documentation/development/logging.html#using-slf4j-api-17

        Show
        Chetan Mehrotra added a comment - Update the Logging document with above information at http://sling.apache.org/documentation/development/logging.html#using-slf4j-api-17

          People

          • Assignee:
            Chetan Mehrotra
            Reporter:
            Chetan Mehrotra
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development