Andreas Covidiot
Andreas Covidiot

Reputation: 4745

WARN: [logback.groovy] (or logback.xml) occurs multiple times on classpath if logback is used in a GWT project

if you just put some logback.groovy (or logback.xml) file in the (recommended) src/logback.groovy location you will likely run into a similar (console) warning:

13:21:08,177 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.groovy] at [file:/D:/my-proj-gwt/src-resource/logback.groovy]
13:21:08,178 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.groovy] occurs multiple times on the classpath.
13:21:08,178 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.groovy] occurs at [file:/D:/my-proj-gwt/war/WEB-INF/classes/logback.groovy]
13:21:08,178 |-WARN in ch.qos.logback.classic.LoggerContext[default] - Resource [logback.groovy] occurs at [file:/D:/my-proj-gwt/src-resource/logback.groovy]

with logging detail output included. The logging INFO output is included because of the multiple occurances of the logback config file(s) in the classpath (src/ and war/WEB-INF/classes).

I found out the way to solve this as answered below...

Upvotes: 1

Views: 2224

Answers (1)

Andreas Covidiot
Andreas Covidiot

Reputation: 4745

After some fiddling I found a solution to this one:

  1. move src/logback.groovy (or logback.xml) to src-resource/logback.groovy
    • create the folder or similar as it may not exist
  2. add src-resources/ to your Java Build Path and adjust its Output Folder to war/WEB-INF/classes (or the same as your src/ Output Folder)
  3. remove src-resources/ from your Web Applications - Run/Debug Configurations - Classpath
    • created in Eclipse after <your project> -> Run As -> Web Application and look then under Run -> Run Configurations ...
    • the src/folder needs to stay in there so GWT is able to compile the JavaScript sources for the client

(my setup: Eclipse Kepler, GWT 2.6.0, logback 1.1.2)

Upvotes: 1

Related Questions