[JIRA] Created: (LBCLASSIC-211) Logback fails to configure in OSGI container, when multiple configurations found

Logback fails to configure in OSGI container, when multiple configurations found -------------------------------------------------------------------------------- Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> ) -- 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

[ http://jira.qos.ch/browse/LBCLASSIC-211?page=com.atlassian.jira.plugin.syste... ] Panov Stanislav commented on LBCLASSIC-211: ------------------------------------------- I get the same error and this error happens from org.apache.felix.framework 1.8.1 and later
Logback fails to configure in OSGI container, when multiple configurations found --------------------------------------------------------------------------------
Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor
When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-211?page=com.atlassian.jira.plugin.syste... ] Panov Stanislav edited comment on LBCLASSIC-211 at 8/15/10 12:52 PM: --------------------------------------------------------------------- I get the same error and this error happens from org.apache.felix.framework 1.8.1 and later In felix changelog.txt: Changes from 1.8.0 to 1.8.1 --------------------------- ** Bug * [FELIX-1154] - Module class loader must be created in privileged block * [FELIX-1190] - Set parent classloader of bundle classloader to be same as what is actually used for delegation * [FELIX-1233] - Bundle class loader should delegate using Class.forName(String, boolean, ClassLoader) to support array types * [FELIX-1237] - STOPPING & STOPPED events not fired when activator throws exception I think that this error is associated with changes in the classloader mechanism. was (Author: stanislav): I get the same error and this error happens from org.apache.felix.framework 1.8.1 and later
Logback fails to configure in OSGI container, when multiple configurations found --------------------------------------------------------------------------------
Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor
When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-211?page=com.atlassian.jira.plugin.syste... ] Panov Stanislav edited comment on LBCLASSIC-211 at 8/15/10 6:11 PM: -------------------------------------------------------------------- I get the same error and this error happens from org.apache.felix.framework 1.8.1 and later environment: Windows 7 x32 java version "1.6.0_21" Java(TM) SE Runtime Environment (build 1.6.0_21-b06) Java HotSpot(TM) Client VM (build 17.0-b16, mixed mode, sharing) But, in this environment all works fine: Ubuntu 10.04 x32 java version "1.6.0_20" Java(TM) SE Runtime Environment (build 1.6.0_20-b02) Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode) In felix changelog.txt: Changes from 1.8.0 to 1.8.1 --------------------------- ** Bug * [FELIX-1154] - Module class loader must be created in privileged block * [FELIX-1190] - Set parent classloader of bundle classloader to be same as what is actually used for delegation * [FELIX-1233] - Bundle class loader should delegate using Class.forName(String, boolean, ClassLoader) to support array types * [FELIX-1237] - STOPPING & STOPPED events not fired when activator throws exception I think that this error is associated with changes in the classloader mechanism. was (Author: stanislav): I get the same error and this error happens from org.apache.felix.framework 1.8.1 and later In felix changelog.txt: Changes from 1.8.0 to 1.8.1 --------------------------- ** Bug * [FELIX-1154] - Module class loader must be created in privileged block * [FELIX-1190] - Set parent classloader of bundle classloader to be same as what is actually used for delegation * [FELIX-1233] - Bundle class loader should delegate using Class.forName(String, boolean, ClassLoader) to support array types * [FELIX-1237] - STOPPING & STOPPED events not fired when activator throws exception I think that this error is associated with changes in the classloader mechanism.
Logback fails to configure in OSGI container, when multiple configurations found --------------------------------------------------------------------------------
Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor
When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-211?page=com.atlassian.jira.plugin.syste... ] Holger Hoffstätte commented on LBCLASSIC-211: --------------------------------------------- It seems to me that contrary to the subject the problem here is not due to multiple configurations, but a combination of a) logback's OSGi unawareness and b) the existence of multiple bindings (backends) on the classpath. One of your bundles seems to embed slf4j, and things go downhill from there. We're using slf4j + logback in both equinox and felix and have not seen this error.
Logback fails to configure in OSGI container, when multiple configurations found --------------------------------------------------------------------------------
Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor
When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )
-- 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

[ http://jira.qos.ch/browse/LBCLASSIC-211?page=com.atlassian.jira.plugin.syste... ] David Riseley commented on LBCLASSIC-211: ----------------------------------------- @Holger - I agree with your comment, however looking at the code, it's clear that a method that is meant to warn when multiple logging configurations are found (ContextInitializer.multiplicityWarning()) is throwing an unhandled exception, which then prevents the fallback configuration from loading correctly. IMHO the fallback configuration mechanism should be bulletproof and never fail in this way , whatever configuration is thrown at it
Logback fails to configure in OSGI container, when multiple configurations found --------------------------------------------------------------------------------
Key: LBCLASSIC-211 URL: http://jira.qos.ch/browse/LBCLASSIC-211 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.9.20 Environment: Apache felix OSGI container, profiling with JProbe. Sun JDK 1.6.0_17 Reporter: David Riseley Assignee: Logback dev list Priority: Minor
When we attempt to profile our application, which runs in an Apache Felix OSGI container, using JProbe the Logback configuration fails with the following exception: Failed to instantiate [ch.qos.logback.classic.LoggerContext] Reported exception: java.lang.IllegalArgumentException: name at sun.misc.URLClassPath$Loader.findResource(URLClassPath.java:458) at sun.misc.URLClassPath$1.next(URLClassPath.java:195) at sun.misc.URLClassPath$1.hasMoreElements(URLClassPath.java:205) at java.net.URLClassLoader$3$1.run(URLClassLoader.java:393) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader$3.next(URLClassLoader.java:390) at java.net.URLClassLoader$3.hasMoreElements(URLClassLoader.java:415) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at sun.misc.CompoundEnumeration.next(CompoundEnumeration.java:27) at sun.misc.CompoundEnumeration.hasMoreElements(CompoundEnumeration.java:36) at ch.qos.logback.core.util.Loader.getResourceOccurenceCount(Loader.java:58) at ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning(ContextInitializer.java:131) at ch.qos.logback.classic.util.ContextInitializer.statusOnResourceSearch(ContextInitializer.java:154) at ch.qos.logback.classic.util.ContextInitializer.findConfigFileURLFromSystemProperties(ContextInitializer.java:88) at ch.qos.logback.classic.util.ContextInitializer.findURLOfDefaultConfigurationFile(ContextInitializer.java:97) at ch.qos.logback.classic.util.ContextInitializer.autoConfig(ContextInitializer.java:119) at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:83) at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:54) at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230) at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121) at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112) at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248) at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerImpl.getLogger(ABCDGUILoggerImpl.java:74) at com.example.csp.gui.interfaces.logger.ABCDGUILoggerFactory.getLogger(ABCDGUILoggerFactory.java:51) at com.example.csp.gui.kernel.util.ABCDGUIKernelUtil.<clinit>(ABCDGUIKernelUtil.java:61) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.setAppBaseBundleInContext(ABCDGUIKernelContextImpl.java:207) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.init(ABCDGUIKernelContextImpl.java:93) at com.example.csp.gui.kernel.context.impl.ABCDGUIKernelContextImpl.<init>(ABCDGUIKernelContextImpl.java:58) at com.example.csp.gui.kernel.activator.impl.KernelActivatorImpl.start(KernelActivatorImpl.java:101) at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589) at org.apache.felix.framework.Felix.startBundle(Felix.java:1458) at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984) at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) at java.lang.Thread.run(Thread.java:619) SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/ngawab/wab_code/code/source/wnb-common-bundles/wnb-common-client/startup-2.0.3/csp-gui-thickclient-bootstrap-2.0.3-all.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [bundle://4.0:1/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. After which we get no logging at all. I appreciate that this will be difficult to reproduce , and I think may be related to the "bundle://" URL format not being recognised, so I had a look at the code in ch.qos.logback.classic.util.ContextInitializer.multiplicityWarning() Currently it catches an IOExeception when calling Loader.getResourceOccurenceCount(), however from the stack trace this can also throw an. IllegalArgumentException So could : try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } Become: try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (Exception e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } I did try this in our environment , and the logging did get successfully configured after this change ( although it wasn't pretty.... :-> )
-- 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
participants (3)
-
David Riseley (JIRA)
-
Holger Hoffstätte (JIRA)
-
Panov Stanislav (JIRA)