0

When I run our test suite slick decides to log at debug level, which makes it hard to see our test output and causes the suite to take longer. I can't figure out how to silence it. I've tried using slf4j-nop as suggested in slick's manual, but it seems our project uses several other loggers and slick is making use of one of those. Here's the relevant part of our project definition:

  libraryDependencies ++= Seq(
    "org.apache.spark" %% "spark-mllib" % SparkVersion,
    "org.postgresql" % "postgresql" % "9.3-1101-jdbc41",
    "com.typesafe.slick" %% "slick" % "3.1.1",
    "com.typesafe.slick" %% "slick-hikaricp" % "3.1.1",
    "com.typesafe.slick" %% "slick-codegen" % "3.1.1"
  ),
  dependencyOverrides ++= Set(
    "org.slf4j" % "slf4j-api" % Slf4jVersion,
    "org.slf4j" % "jcl-over-slf4j" % Slf4jVersion,
    "org.slf4j" % "jul-to-slf4j" % Slf4jVersion
  ),
  dependencyOverrides in test := Set(
    "org.slf4j" % "slf4j-nop" % "1.6.4"), //no-op logger for slick

Some of the things I've tried already, none of which work:

  • add logback.xml to the test resources as suggested in Turn Slick logging off.
  • add logging.properties and commons-logging.properties to test resources with .level=WARN
  • add logger.scala.slick=WARN in my application.conf
adambaker
  • 31
  • 5

2 Answers2

0

Just add this line to your logback.xml:

<logger name="slick" level="WARN" />

Paul Dolega
  • 2,446
  • 14
  • 23
  • I edited the name in the logback.xml I'd tried from a suggestion in another question (from "scala.slick" to "slick" as you suggest), but that didn't do anything. – adambaker Dec 23 '16 at 01:54
  • Also, the project didn't have an existing logback.xml to add to, nor is logback listed as a dependency, so I think we just aren't using it. – adambaker Dec 23 '16 at 01:59
0

Slick was using Log4j to do its logging. Strangely enough, just adding an empty src/test/resources/log4j.properties file to the project was good enough to silence it during test runs.

adambaker
  • 31
  • 5