[logback-dev] [JIRA] Commented: (LBCLASSIC-184) Remove Cyclic Dependencies between Classic, SLF4J API and SLF4J Impl

Gunnar Wagenknecht (JIRA) noreply-jira at qos.ch
Tue Mar 2 10:25:16 CET 2010


    [ http://jira.qos.ch/browse/LBCLASSIC-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11585#action_11585 ] 

Gunnar Wagenknecht commented on LBCLASSIC-184:
----------------------------------------------

Hi Ceki,

Here is the recipe for reproducing the problem:

- Extract  "org.slf4j.impl" package from logback-classic.jar into it's own jar/bundle

You should now have four bundles:
  - slf4j-api
  - logback-core
  - logback-classic
  - logback-slf4j-impl


The MANIFEST.MF files should look like:

Manifest of SLF4J API bundle:
----
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name.0
Bundle-SymbolicName: org.slf4j.api
Bundle-Version: 1.5.10.qualifier
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.3,
 CDC-1.1/Foundation-1.1
Export-Package: org.slf4j;version="1.5.10",
 org.slf4j.helpers;version="1.5.10",
 org.slf4j.spi;version="1.5.10"
----

Manifest of Logback Core bundle:
----
Manifest-Version: 1.0
Bundle-Localization: plugin
Bundle-Name: %Bundle-Name.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Version: 0.9.18.qualifier
Bundle-ManifestVersion: 2
Import-Package: javax.mail;resolution:=optional,
 javax.mail.internet;resolution:=optional,
 javax.naming;resolution:=optional,
 javax.servlet;resolution:=optional,
 javax.servlet.http;resolution:=optional,
 javax.sql;resolution:=optional,
 javax.xml.parsers;resolution:=optional,
 org.codehaus.janino;resolution:=optional,
 org.slf4j;version="1.5.10",
 org.slf4j.helpers;version="1.5.10",
 org.slf4j.spi;version="1.5.10",
 org.xml.sax;resolution:=optional,
 org.xml.sax.helpers;resolution:=optional
Bundle-SymbolicName: ch.qos.logback.core
Export-Package: ch.qos.logback.core;version="0.9.18",
 ch.qos.logback.core.boolex;version="0.9.18",
 ch.qos.logback.core.db;version="0.9.18",
 ch.qos.logback.core.db.dialect;version="0.9.18",
 ch.qos.logback.core.filter;version="0.9.18",
 ch.qos.logback.core.helpers;version="0.9.18",
 ch.qos.logback.core.html;version="0.9.18",
 ch.qos.logback.core.joran;version="0.9.18",
 ch.qos.logback.core.joran.action;version="0.9.18",
 ch.qos.logback.core.joran.event;version="0.9.18",
 ch.qos.logback.core.joran.spi;version="0.9.18",
 ch.qos.logback.core.layout;version="0.9.18",
 ch.qos.logback.core.net;version="0.9.18",
 ch.qos.logback.core.pattern;version="0.9.18",
 ch.qos.logback.core.pattern.parser;version="0.9.18",
 ch.qos.logback.core.pattern.util;version="0.9.18",
 ch.qos.logback.core.read;version="0.9.18",
 ch.qos.logback.core.rolling;version="0.9.18",
 ch.qos.logback.core.rolling.helper;version="0.9.18",
 ch.qos.logback.core.sift;version="0.9.18",
 ch.qos.logback.core.spi;version="0.9.18",
 ch.qos.logback.core.status;version="0.9.18",
 ch.qos.logback.core.util;version="0.9.18"
----

Manifest of Logback Classic bundle:
----
Manifest-Version: 1.0
Bundle-Localization: plugin
Bundle-Name: %Bundle-Name.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Version: 0.9.18.qualifier
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ch.qos.logback.classic
Export-Package: ch.qos.logback.classic;version="0.9.18",
 ch.qos.logback.classic.boolex;version="0.9.18",
 ch.qos.logback.classic.db;version="0.9.18",
 ch.qos.logback.classic.filter;version="0.9.18",
 ch.qos.logback.classic.html;version="0.9.18",
 ch.qos.logback.classic.jmx;version="0.9.18",
 ch.qos.logback.classic.joran;version="0.9.18",
 ch.qos.logback.classic.joran.action;version="0.9.18",
 ch.qos.logback.classic.log4j;version="0.9.18",
 ch.qos.logback.classic.net;version="0.9.18",
 ch.qos.logback.classic.pattern;version="0.9.18",
 ch.qos.logback.classic.selector;version="0.9.18",
 ch.qos.logback.classic.selector.servlet;version="0.9.18",
 ch.qos.logback.classic.sift;version="0.9.18",
 ch.qos.logback.classic.spi;version="0.9.18",
 ch.qos.logback.classic.turbo;version="0.9.18",
 ch.qos.logback.classic.util;version="0.9.18"
Import-Package: ch.qos.logback.core;version="0.9",
 ch.qos.logback.core.boolex;version="0.9",
 ch.qos.logback.core.db;version="0.9",
 ch.qos.logback.core.filter;version="0.9",
 ch.qos.logback.core.helpers;version="0.9",
 ch.qos.logback.core.html;version="0.9",
 ch.qos.logback.core.joran;version="0.9",
 ch.qos.logback.core.joran.action;version="0.9",
 ch.qos.logback.core.joran.event;version="0.9",
 ch.qos.logback.core.joran.spi;version="0.9",
 ch.qos.logback.core.net;version="0.9",
 ch.qos.logback.core.pattern;version="0.9",
 ch.qos.logback.core.rolling;version="0.9",
 ch.qos.logback.core.rolling.helper;version="0.9",
 ch.qos.logback.core.sift;version="0.9",
 ch.qos.logback.core.spi;version="0.9",
 ch.qos.logback.core.status;version="0.9",
 ch.qos.logback.core.util;version="0.9",
 javax.jms;resolution:=optional,
 javax.mail;resolution:=optional,
 javax.mail.internet;resolution:=optional,
 javax.management;resolution:=optional,
 javax.naming;resolution:=optional,
 javax.servlet;resolution:=optional,
 javax.servlet.http;resolution:=optional,
 org.slf4j;version="1.5.10",
 org.slf4j.helpers;version="1.5.10",
 org.slf4j.spi;version="1.5.10",
 org.xml.sax;resolution:=optional,
 sun.reflect;resolution:=optional
----

Manifest of Logback SLF4J Impl bundle:
----
Manifest-Version: 1.0
Bundle-Localization: fragment
Bundle-Name: %Bundle-Name.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor.0
Bundle-Version: 0.9.18.qualifier
Bundle-ManifestVersion: 2
Bundle-SymbolicName: ch.qos.logback.slf4j
Fragment-Host: org.slf4j.api;bundle-version="[1.5.10,1.5.11)"
Import-Package: ch.qos.logback.classic;version="0.9",
 ch.qos.logback.classic.selector;version="0.9",
 ch.qos.logback.classic.spi;version="0.9.0",
 ch.qos.logback.classic.util;version="0.9",
 ch.qos.logback.core;version="0.9",
 ch.qos.logback.core.joran;version="0.9",
 ch.qos.logback.core.joran.spi;version="0.9",
 ch.qos.logback.core.util;version="0.9"
Export-Package: org.slf4j.impl;version="1.5.10"
----


Using this bundle structure it is impossible to get this started at runtime because classes cannot be resolved properly between logback-classic and logback-slf4j-impl bundle.

I looked at your osgi-build.xml but it doesn't seem like this file is producing the actual OSGi bundles. I'm also not familiar with the Maven plug-ins producing the bundles. Otherwise I would have provided a patch to the pom.xml. But I hope the steps provided outline the changes necessary to the OSGi packaging/bundling.

The different bundle setup is necessary in order to provide a more specific integration of SLF4J and Logback with OSGi. In our system we provide a native OSGi-aware SLF4J implementation. We'd like to now use Logback Classic as our logging backend. However the current bundling doesn't allow this because it produces resolution conflicts especially when you want to run multiple versions of API and Logback and a native implementation in the same OSGi instance. 

> Remove Cyclic Dependencies between Classic, SLF4J API and SLF4J Impl
> --------------------------------------------------------------------
>
>                 Key: LBCLASSIC-184
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-184
>             Project: logback-classic
>          Issue Type: Task
>          Components: Other
>    Affects Versions: 0.9.18
>            Reporter: Gunnar Wagenknecht
>            Assignee: Ceki Gulcu
>         Attachments: context-selector.patch, mdc-move.patch
>
>
> When working with Logback as OSGi bundles I found some issues regarding cyclic dependencies. Basically, code in "org.slf4j.impl" depends on "org.slf4j.api" as well as Logback classic. This is fine. However, code in Logback classic also depends on "org.slf4j.impl". This introduces a cycle.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list