如何禁用SBT中特定依赖项的日志记录? [英] How do I disable logging for a specific dependency in SBT?

查看:97
本文介绍了如何禁用SBT中特定依赖项的日志记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下build.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"
)

如何为我自己的(当前)项目启用DEBUG级别报告,但为另一个项目禁用它.在这种情况下,我不想看到Slick库的调试输出,但仍然想看到自己项目的调试日志记录.

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.

推荐答案

在logback.xml中添加如下所示的条目:

In your logback.xml add an entry like this:

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

这意味着,当通过名称空间com.typesafe.slick的任何类获取记录器时,会将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.

这是文档的链接.

这篇关于如何禁用SBT中特定依赖项的日志记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆