2013-05-14 3 views
9

SBT의 디버그 메시지를 어떻게 억제합니까?SBT 디버그 출력 억제

$ cat src/main/scala/Hello.scala 
object Hello { 
    def main(args: Array[String]) { 
    Console.println("Hello sbt") 
    } 
} 

$ sbt run > out.txt 

$ cat out.txt 
[info] Set current project to hello (in build file:/home/synapse/projects/algs2/) 
[info] Running Hello 
Hello sbt 
[success] Total time: 1 s, completed May 14, 2013 11:39:23 PM 
+1

혹시 해결책을 찾았나요? 나는 이것에 대해서도 고심하고있다. – dcb

+1

가능한 [sbt에서 정보 및 성공 메시지를 표시하지 않으려면 어떻게합니까?] (http://stackoverflow.com/questions/9968300/how-to-suppress-info-and-success-messages-in-sbt) –

답변

1

당신은 설명 here 같은 로깅 수준을 변경할 수 있습니다 : 그들은 그래서 프로젝트를 실행 stdout에 기록되는 것은이 생산하고 있습니다. 그래서 당신은 Warn에 로깅 수준을 변경할 수 있습니다

> run 
[info] Running Server 
Port is: null 
Embedded server running on port 8080. Press any key to stop. 

[success] Total time: 3 s, completed 14-May-2013 21:02:31 
> 
> set logLevel in run := Level.Warn 
... 
[info] Reapplying settings... 
[info] Set current project to server (in build file:/Users/me/myproject/) 
> run 
Port is: null 
Embedded server running on port 8080. Press any key to stop. 

당신은 더 이상 run 명령에 대한 인쇄 정보 메시지를 얻을. 설정을 빌드 파일에 추가하여 영구적으로 만들 수 있습니다.

+7

빌드 .sbt는 logLevel : = Level.Error와 sbt run으로 정보와 성공 메시지를 출력한다. – synapse

6

this reference에서도 언급했듯이 다른 답변으로 연결되어 있기 때문에 sbt 콘솔에 도달하기 전에 로깅 수준을 변경할 수 있습니다.

"시작시 명령이 실행되기 전에 로깅 수준을 설정하려면 로깅 수준 전에 --을 사용하십시오."

예를

$ sbt --error "runMain my.pckg.Main" 

를 들어 당신은 여전히 ​​마지막에 기록 된 [success] 메시지가 그러나. 소음을 줄이려면 grep -v으로 배관을 고려하십시오.

+0

''build.sbt'에'showSuccess : = false'를 추가하면'[success]'를 제거 할 수 있습니다. –

0

로그 수준 속성을 전역 SBT 속성에 추가 할 수 있습니다. 이 SBT 버전 1.x 작동

파일 : ~/.sbt/1.0/global.sbt
logLevel := Level.Warn 

shellPrompt := { state => 
    "sbt (%s)> ".format(Project.extract(state).currentProject.id) 
}