
[ http://jira.qos.ch/browse/LBCLASSIC-159?page=com.atlassian.jira.plugin.syste... ] Derek Mahar edited comment on LBCLASSIC-159 at 8/4/10 9:03 PM: --------------------------------------------------------------- Changing the return value of method getResourceOccurenceCount(String, ClassLoader) from "List<URL>" to "Set<URL>" in class ch.qos.logback.core.util.Loader should resolve this issue: public static List<URL> getResourceOccurenceCount(String resource, ClassLoader classLoader) throws IOException { List<URL> urlList = new ArrayList<URL>(); Enumeration<URL> urlEnum = classLoader.getResources(resource); while (urlEnum.hasMoreElements()) { URL url = urlEnum.nextElement(); urlList.add(url); } return urlList; } Method multiplicityWarning(String, ClassLoader) in class ch.qos.logback.classic.util.ContextInitializer uses this method to decide whether or not to print the multiple classpath entry warning: private void multiplicityWarning(String resourceName, ClassLoader classLoader) { List<URL> urlList = null; StatusManager sm = loggerContext.getStatusManager(); try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } if (urlList != null && urlList.size() > 1) { sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.", loggerContext)); for (URL url : urlList) { sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]", loggerContext)); } } } (Note that this is the state of the code as of release 0.9.24 (http://github.com/derekmahar/logback/tree/v_0.9.24) or commit 10b6686ab92a53f860b14953ce8493d5c3534a46 (http://github.com/ceki/logback/commit/10b6686ab92a53f860b14953ce8493d5c3534a... ).) was (Author: derekmahar): Changing the return value of method getResourceOccurenceCount(String, ClassLoader) from "List<URL>" to "Set<URL>" in class ch.qos.logback.core.util.Loader should resolve this issue: public static List<URL> getResourceOccurenceCount(String resource, ClassLoader classLoader) throws IOException { List<URL> urlList = new ArrayList<URL>(); Enumeration<URL> urlEnum = classLoader.getResources(resource); while (urlEnum.hasMoreElements()) { URL url = urlEnum.nextElement(); urlList.add(url); } return urlList; } Method multiplicityWarning(String, ClassLoader) in class ch.qos.logback.classic.util.ContextInitializer uses this method to decide whether or not to print the multiple classpath entry warning: private void multiplicityWarning(String resourceName, ClassLoader classLoader) { List<URL> urlList = null; StatusManager sm = loggerContext.getStatusManager(); try { urlList = Loader.getResourceOccurenceCount(resourceName, classLoader); } catch (IOException e) { sm.add(new ErrorStatus("Failed to get url list for resource [" + resourceName + "]", loggerContext, e)); } if (urlList != null && urlList.size() > 1) { sm.add(new WarnStatus("Resource [" + resourceName + "] occurs multiple times on the classpath.", loggerContext)); for (URL url : urlList) { sm.add(new WarnStatus("Resource [" + resourceName + "] occurs at [" + url.toString() + "]", loggerContext)); } } } (Note that this is the state of the code as of release 0.9.24 (http://github.com/derekmahar/logback/tree/v_0.9.24) or commit 10b6686ab92a53f860b14953ce8493d5c3534a46 (http://github.com/ceki/logback/commit/10b6686ab92a53f860b14953ce8493d5c3534a...).)
Invalid multiple configuration file warning -------------------------------------------
Key: LBCLASSIC-159 URL: http://jira.qos.ch/browse/LBCLASSIC-159 Project: logback-classic Issue Type: Bug Components: Other Affects Versions: 0.917 Environment: Resin webapp Reporter: Hontvári József Assignee: Logback dev list
I receive strange warnings in the status info. It says that logback.xml, which in this case comes from a file and not from the classpath, occurs multiple times. The file is specifies and logged using absolute path, so even relative paths cannot cause the warning. Logback configuration file is specified by the system property "logback.configurationFile". It is done by the Resin application server, somehow it is able to supply different properties for different web applications. I don't think this is important, however. Maybe I am doing something wrong, but at least the message doesn't help. 20:36:34,236 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [file:/C:/Progra~1/mireka/conf/logback.xml] at [file:/C:/Progra~1/mireka/conf/logback.xml] 20:36:34,236 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [file:/C:/Progra~1/mireka/conf/logback.xml] occurs multiple times on the classpath. 20:36:34,236 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [file:/C:/Progra~1/mireka/conf/logback.xml] occurs at [file:/C:/Progra~1/mireka/conf/logback.xml] 20:36:34,236 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [file:/C:/Progra~1/mireka/conf/logback.xml] occurs at [file:/C:/Progra~1/mireka/conf/logback.xml] 20:36:34,236 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [file:/C:/Progra~1/mireka/conf/logback.xml] occurs at [file:/C:/Progra~1/mireka/conf/logback.xml]
-- 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