How do I suppress SBT's debug messages? They are logged to stdout so running a project produces this:
$ 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
As mentioned in this reference also linked by the other answer, it is possible to change logging level before arriving at the sbt console.
"To set the logging level before any commands are executed on startup, use --
before the logging level."
For example
$ sbt --error "runMain my.pckg.Main"
However you still get the [success]
message logged at the end. For silencing that, consider piping into grep -v
.
You can alter the logging level as described here. So you can changed the logging level to 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.
and you no longer get the info messages printed for the run
command. You can add the setting to your build file to make it permanent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With