How to change log level from command line?

For SBT 0.12:

If you want to change the log level from the command line, you may do in sbt interactive mode without changing your build.sbt file or any configuration. Just type:

> set logLevel := Level.Debug

However if you are writing some scripts that will run in your server and you can't do interactively, you will have to create a boot.properties file setting the desired log level and pass this file in the command line, by running

sbt -Dsbt.boot.properties=path-to-your-boot.properties

Check the documentation for boot.properties here


As described in Change the logging level globally for sbt:

To set the logging level before any commands are executed on startup, use -- before the logging level

There are four logging levels:

  • debug
  • info
  • warn
  • error

If you need one applied "at the command line without modifying the existing configuration", execute the sbt launcher with appropriate level prefixed with double dashes.

jacek:~/oss/scalania
$ sbt --debug
[debug] > boot
[debug] > reload
[debug] > sbtStashOnFailure
[debug] > onFailure load-failed
[debug] > loadp
[info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins
[debug] Running task... Cancelable: false, check cycles: false
[debug]

With sbt.boot.properties you may get sbt internal logs printed out, too. See Launcher Specification.

Tags:

Sbt