Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable logging for a specific dependency in SBT?

I have the following build.sbt file:

version := "0.1"

scalaVersion := "2.10.0-RC1"

scalacOptions := Seq("-unchecked", "-deprecation", "-encoding", "utf8")

resolvers ++= Seq(
  "sonatype releases" at "https://oss.sonatype.org/content/repositories/releases/",
  "sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
  "typesafe repo" at "http://repo.typesafe.com/typesafe/releases/",
  "spray repo" at "http://repo.spray.io/"
)

libraryDependencies ++= Seq(
  "io.spray"           %   "spray-can"         % "1.1-M4.2"
  ,"io.spray"          %   "spray-routing"     % "1.1-M4.2"
  ,"io.spray"          %   "spray-testkit"     % "1.1-M4.2"
  ,"io.spray"          %%  "spray-json"        % "1.2.2"     cross CrossVersion.full
  ,"com.typesafe.akka" %%  "akka-actor"        % "2.1.0-RC1" cross CrossVersion.full
  ,"org.specs2"        %%  "specs2" % "1.12.2" % "test"      cross CrossVersion.full
  ,"com.typesafe"      %   "slick_2.10.0-RC1"  % "0.11.2"
  ,"com.h2database"    %   "h2"                % "1.3.166"
  ,"org.xerial"        %   "sqlite-jdbc"       % "3.6.20"
  ,"org.slf4j"         %   "slf4j-api"         % "1.6.4"
  ,"ch.qos.logback"    %   "logback-classic"   % "1.0.7"
  ,"org.specs2"        %   "specs2_2.10.0-RC1" % "1.12.2"    % "test"
  ,"junit"             %   "junit"             % "4.8.1"     % "test"
)

How do I enable DEBUG level reporting for my own (the current) project, but disable it for another. In this case I don't want to see the Slick library's debug output, but still want to see debug logging for my own project.

like image 875
Jack Avatar asked Nov 08 '12 09:11

Jack


People also ask

How to exclude dependencies in SBT?

We exclude dependencies in SBT by using either the exclude or excludeAll keywords. It's important to understand which one to use: excludeAll is more flexible but cannot be represented in a pom. xml. Therefore, we should use exclude if a pom.

What is SBT dependency?

SBT Dependencies SBT is the most usual build tool for Scala projects. As a project gets more complex, it will increase the number of dependencies. And each dependency brings other dependencies, called transitive dependencies. Eventually, a project can suffer from the JAR dependency hell.

Where are SBT dependencies?

If you have JAR files (unmanaged dependencies) that you want to use in your project, simply copy them to the lib folder in the root directory of your SBT project, and SBT will find them automatically.

What is Ivy in SBT?

Apache Ivy is a transitive package manager. It is a sub-project of the Apache Ant project, with which Ivy works to resolve project dependencies. An external XML file defines project dependencies and lists the resources necessary to build a project.


1 Answers

In your logback.xml add an entry like this:

<logger name="com.typesafe.slick" level="INFO"/>

This means, that when a logger is obtained by any class of the namespace com.typesafe.slick it will have INFO set as log level.

edit: Here's the link to the documentation.

like image 100
drexin Avatar answered Oct 10 '22 06:10

drexin