[logback-dev] [JIRA] Commented: (LBCLASSIC-85) Multiply logback.xml files on the classpath, the first one will be used without notification

Ceki Gulcu (JIRA) noreply-jira at qos.ch
Mon Dec 29 17:19:38 CET 2008


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

Ceki Gulcu commented on LBCLASSIC-85:
-------------------------------------

ContextInitializer class has been modified to report multiple occurences of  a resource as a warning. Here is sample output:

INFO in c.q.l.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
INFO in c.q.l.classic.LoggerContext[default] - Found resource [logback.xml] at [file:lb/logback-classic/target/test-classes/logback.xml]
WARN in c.q.l.classic.LoggerContext[default] - Resource [logback.xml] occurs multiple times on the classpath.
WARN in c.q.l.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:lb/logback-classic/target/test-classes/logback.xml]
WARN in c.q.l.classic.LoggerContext[default] - Resource [logback.xml] occurs at [file:lb/logback-core/target/test-classes/logback.xml]
INFO in c.q.l.classic.joran.action.ConfigurationAction - debug attribute not set
INFO in c.q.l.core.joran.action.AppenderAction - About to instantiate appender of type [c.q.l.core.ConsoleAppender]
..etc


> Multiply logback.xml files on the classpath, the first one will be used without notification
> --------------------------------------------------------------------------------------------
>
>                 Key: LBCLASSIC-85
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-85
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 0.9.11
>            Reporter: Szel Zoltan
>            Assignee: Logback dev list
>
> Hi all,
>  
> i have hit this issue a couple of times now, so i go ahead and rise it. 
>  
> We are creating libraries to our developers, which are usually have an example part, where they can try our piece of software out. These examples are part of our Eclipse project. All these examples have a logback.xml file to show how a complete application should look like. During development, this causes some issues because the first one in the classpath will be loaded, so i ended up to use the manual config loading via Joran, but it took me some time to figure out the root cause of the issue. I imagine, this will cause issues when developers will start to bundle there logback.xml file into there jars. 
>  
> Could the ContextInitializer be changed to detect such a scenario and report it? The change is fairly easy, instead of using the getResource(String name) function from the ClassLoader class, you could go with the getResources(String name) function, check if it returned more than one element, than report to the Status manager the fact, that there are more than 1 logback.xml file on the classpath and the first one will be used. 
>  
> Thanks in advance,
>  
> Kind Regards,
> Zoltan Szel

-- 
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