Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
924 views
in Technique[技术] by (71.8m points)

scala - How to suppress info and success messages in sbt?

When I do sbt run I see some header and footer info which I would like to get rid of:

$ sbt run 
[info] Set current project to XXX (in build file:/path/to/dir/)
<actual program output goes here; stuff I care about>
[success] Total time: 68 s, completed Apr 1, 2012 7:30:45 PM
$ 

How can I get rid of those 2 additional lines (i.e., the [info] and [success] lines)? Are there some build.sbt configuration settings available to do that? Ideally I don't want to have another tool/dependency just to get rid of those 2 lines.

Following is a list of things I have tried:

  • Set run logLevel to Warn
  • Set Global logLevel to Warn
  • Set -Dsbt.log.noformat=true

Workaround that I am currently using: Copy the java invocation that sbt generates (by doing ps or top) as a result of doing fork in run := true and manually run that java command directly on command line.

It would best and much cleaner if sbt can be told not to print those lines.

  • Scala version: 2.9.1
  • SBT version: 0.11.1
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

sbt 1.x, sbt 0.13.13+

Use -warn or -error. See Fixes with compatibility implications for sbt 0.13.13 release:

it is strongly encouraged to migrate to the single hyphen options: -error, -warn, -info, and -debug

sbt 0.13.1

To disable info messages run SBT with --warn or --error command line options.

To disable [success] messages set showSuccess to false.

Bringing it all together, it gives you the following options:

  • On command line use the following:

      $ sbt --error 'set showSuccess := false' run
    
  • In build.sbt add showSuccess := false

      $ cat build.sbt
      showSuccess := false
    

and execute sbt --error run.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.8k users

...