[logback-user] Resource [file:logback.xml] occurs multiple times on the classpath

Jason Berk jasonrberk at gmail.com
Mon Jul 25 14:51:35 CEST 2011


jberk at pc0022-ubuntu:~/desktop$ java -version
java version "1.6.0_24"
Java(TM) SE Runtime Environment (build 1.6.0_24-b07)
Java HotSpot(TM) Server VM (build 19.1-b02, mixed mode)

it's not a web application...there is no app server.  It's a simple
runnable jar from eclipse.

I'm passing in the logback.xml location via -DlogbackConfiguration=....

1) create a new java project in eclipse
2) create a "lib" directory at the root of the project
3) import the SLF4J and LogBack jars into the lib directory
4) right click on those jars and do "add to build path"
5) write some code
6) right click on project and do "export..." and select "runnable jar"
7) run the jar from the CLI:  java [-D args] -jar Foo.jar [args]

Jason

On Wed, Jul 20, 2011 at 4:48 PM, Ceki Gulcu <ceki at qos.ch> wrote:
> Hi Jason,
>
> I've never seen this before. Can you describe your environment? which JDK?
> which application server...?
>
> On 15.07.2011 15:31, Jason Berk wrote:
>>
>> any ideas?
>>
>> On Thu, Jul 14, 2011 at 2:43 PM, Jason Berk<jasonrberk at gmail.com>  wrote:
>>>
>>> 0.9.29
>>>
>>>
>>>
>>> On Thu, Jul 14, 2011 at 1:28 PM, David Roussel
>>> <nabble at diroussel.xsmail.com>  wrote:
>>>>
>>>> What version of logback are you using?
>>>>
>>>> On 14 Jul 2011, at 19:09, Jason Berk<jasonrberk at gmail.com>  wrote:
>>>>
>>>>> new user here....making the jump for log4j to logback.  Running an
>>>>> executable jar where logback.xml is NOT in the jar.  Application works
>>>>> as expected, but I'm seeing all these "Resource [file:logback.xml]
>>>>> occurs at [file:logback.xml]" in the log.
>>>>>
>>>>> jberk at ubuntu:~/apps$ java -Dlogback.configurationFile=file:logback.xml
>>>>> -Dapp.props=file:app.props \
>>>>> -Dinput.file=test.txt -Doutput.dir=pdf -jar MyJar.jar mortgage
>>>>>
>>>>> 13:01:09,754 |-INFO in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Found resource [file:logback.xml] at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs multiple times on the classpath.
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,756 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,757 |-WARN in ch.qos.logback.classic.LoggerContext[default] -
>>>>> Resource [file:logback.xml] occurs at [file:logback.xml]
>>>>> 13:01:09,830 |-INFO in
>>>>> ch.qos.logback.classic.joran.action.ConfigurationAction - debug
>>>>> attribute not set
>>>>> 13:01:09,835 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
>>>>> - About to instantiate appender of type
>>>>> [ch.qos.logback.core.ConsoleAppender]
>>>>> 13:01:09,839 |-INFO in ch.qos.logback.core.joran.action.AppenderAction
>>>>> - Naming appender as [STDOUT]
>>>>> 13:01:09,866 |-INFO in
>>>>> ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming
>>>>> default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for
>>>>> [encoder] property
>>>>> 13:01:09,914 |-INFO in
>>>>> ch.qos.logback.classic.joran.action.LoggerAction - Setting level of
>>>>> logger [org.springframework] to OFF
>>>>> 13:01:09,914 |-INFO in
>>>>> ch.qos.logback.classic.joran.action.LoggerAction - Setting level of
>>>>> logger [org.apache] to OFF
>>>>> 13:01:09,914 |-INFO in
>>>>> ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level
>>>>> of ROOT logger to DEBUG
>>>>> 13:01:09,914 |-INFO in
>>>>> ch.qos.logback.core.joran.action.AppenderRefAction - Attaching
>>>>> appender named [STDOUT] to Logger[ROOT]
>>>>> ....my app logs omitted.....
>>>>>
>>>>> here is my logback.xml:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <configuration>
>>>>>  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
>>>>>    <encoder>
>>>>>      <pattern>%d %-5level %C[%M%L] - %msg%n</pattern>
>>>>>    </encoder>
>>>>>  </appender>
>>>>>
>>>>>  <!-- Turn off third party chatter -->
>>>>>  <logger name="org.springframework" level="OFF"/>
>>>>>  <logger name="org.apache" level="OFF"/>
>>>>>
>>>>>  <root level="debug">
>>>>>    <appender-ref ref="STDOUT"/>
>>>>>  </root>
>>>>> </configuration>
>>>>>
>>>>> 1) why is this happening?
>>>>> 2) is this something I am doing wrong (and how to fix)
>>>>>
>>>>> thanks for the great tool and any help.
>>>>>
>>>>> Jason
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://qos.ch/mailman/listinfo/logback-user
>



-- 
Jason Berk
http://picasaweb.google.com/JasonRBerk


More information about the Logback-user mailing list