How can I change the log level in sbt at the command line without modifying the existing configuration?
To change log levels as a root user, perform the following: To enable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=DEBUG) To disable debug logging, run the following command: /subsystem=logging/root-logger=ROOT:change-root-log-level(level=INFO)
You can change the logging level or trace level (also called the debug level) of a running process by sending a USR1 or USR2 signal to the process. Sending a USR1 signal changes the logging level and sending a USR2 signal changes the trace level.
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:
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.
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
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