3

Having transferred a working project into SBT, I've noticed that logback can't seem to find logback.xml - even when it's in src/main/resources/logback.xml. Or anywhere else for that matters, e.g. classpath. Has anybody else had this problem?

Here is my build.sbt file:

name := "goGame"

version := "1.0"

scalaVersion := "2.9.2"

libraryDependencies += "org.slf4j" % "slf4j-simple" % "1.6.4"

libraryDependencies += "org.scalatest" % "scalatest_2.9.0" % "1.9.1"

libraryDependencies += "ch.qos.logback" % "logback-core" % "1.0.13"

libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.0.13" 

libraryDependencies += "com.github.scct" % "scct_2.10" % "0.2.1"

libraryDependencies += "org.scala-lang" % "scala-swing" % "2.9.2"

libraryDependencies += "org.hamcrest" % "hamcrest-all" % "1.3"

libraryDependencies += "junit" % "junit" % "4.11"
Jacek Laskowski
  • 72,696
  • 27
  • 242
  • 420
Kevin
  • 371
  • 5
  • 15
  • 1
    `src/main/resources` is the place I'd use for such files. What does logback print out that makes you feel it can't find the file? – Jacek Laskowski Mar 10 '14 at 10:14
  • possible duplicate of [configure logback for sbt / scala project](http://stackoverflow.com/questions/5215664/configure-logback-for-sbt-scala-project) – Jacek Laskowski Mar 10 '14 at 10:16
  • Hi Jacek, thanks for your reply. The logging is definitely happening as I can see log4j style [info] messages. But when I try and modify the logback.xml it makes no difference what level I set individual classes to. Even if I delete the logback.xml file I still get exactly the same logging messages. I think everything is being logged. Interestingly when I create the file on the src/main/resources and run sbt.. the file does get automatically copied into a classes area but I see no evidence it is being used :( – Kevin Mar 10 '14 at 10:52
  • I don't know logback so can't help much, but my suggestion would be to (mimic what SBT does and) use `logback.xml` on the command line to have it picked up? – Jacek Laskowski Mar 10 '14 at 13:39
  • Finally fixed by removing unnecessary dependencies and being more careful about blank lines (that weren't) in the build.sbt file. – Kevin Mar 15 '14 at 21:02
  • 1
    Could you post the solution as an answer and approve? – Jacek Laskowski Mar 15 '14 at 21:12

0 Answers0