I would like to disable the color escape codes logged from sbt/play. Is this possible? And if it is, is there a way to do it without making changes to the config - i.e. via a command line switch or system property.
-
Consider accepting Steven Shaws answer now? – samthebest Jul 02 '16 at 10:09
5 Answers
Since version 0.13.8
(and possibly earlier) you can now simply use the -no-colors
option to sbt. e.g.
sbt -no-colors test

- 30,803
- 25
- 102
- 142

- 6,063
- 3
- 33
- 44
-
3this is a better answer than the accepted answer if you are using a more recent version of sbt – ishaaq Aug 25 '15 at 05:25
-
what's the point of having the two commands though? `dependencies` is not even a valid sbt command in my sbt setup. – matanster Jan 11 '16 at 20:02
-
I edited the answer to use `test` instead of `dependencies`, and made the implicit point about sbt version explicit. This should address @matanster points. – samthebest Jul 02 '16 at 10:08
-
1
You can simply set the system property sbt.log.noformat
to true
. If you want to e.g. use SBT inside Vim you can create a script like this:
#!/bin/bash
java -Dsbt.log.noformat=true $JAVA_OPTS -jar "${HOME}/bin/sbt-launch.jar" "$@"

- 14,144
- 2
- 56
- 55
-
25This also works as an argument to sbt itself: `sbt -Dsbt.log.noformat=true`, and if you use [sbt "the rebel cut"](https://github.com/paulp/sbt-extras), you can use the argument `-no-colors`. – tobym Aug 23 '12 at 18:17
-
@jilen - Do you have an example of it for play? I can't seem to figure out how to do it: http://stackoverflow.com/q/22665543/20770 – cdeszaq Mar 26 '14 at 15:21
This sounds like your platform does not match the actual jline.terminal property. I am just guessing here but when I pass the parameter as Daniel suggested on a Windows command line I see the color escape codes as well.
Therefore, you have to make sure the property matches your platform, i.e. WindowsTerminal on Windows and UnixTerminal on Unix.
If this does not help, then you might be on an unsupported platform in which case the website suggests to use:
-Djline.terminal=jline.UnsupportedTerminal

- 1,884
- 2
- 17
- 12
-
2Sorry to clarify, it is not that the colouring does not work, just that I want to be able to disable. @Moritz's answer helped me out. – Mark Hibberd Nov 25 '10 at 10:14
Well, you can get colors on Windows by installing Cygwin and passing this parameter:
-Djline.terminal=jline.UnixTerminal
So I'd look up jline parameters to see what disables color coding.

- 295,120
- 86
- 501
- 681
-
Ar you using rxvt or mintty? Under default cygwin console using cmd.exe I'm getting that kind of output: `←[0m[←[0minfo←[0m] ←[0mBuilding project`... – huynhjl Nov 24 '10 at 17:38
-
@huynhjl No, I never tried to get that tip to work. I'm a bit suprised at the output, though. What's the value of TERM? – Daniel C. Sobral Nov 24 '10 at 18:01
-
TERM is set to cygwin. The main annoyance I have with cygwin right now is that multi line editing does not work (once it wraps, can't go back and edit previous line with the right visual feedback). I've figured out that jline can't deal with ansi code on win32 under cygwin. So I was interested to see how color would have worked with sbt.. – huynhjl Nov 24 '10 at 18:53
I was able to get colored output from SBT in Cygwin by adding:
-Djline.terminal=jline.UnixTerminal
Additionally I figured out that I also needed to add the following line to Cygwin.bat:
set CYGWIN=tty ntsec
After that is added SBT gives very nice colored output. Additionally I would recommend looking into Console2 as it can hook through Cygwin, but provides a much better interface in my opinion:

- 1,053
- 8
- 29
-
i've tried with both console2 and cmd and there're a few problems: tab completion does not work, backspace does not work, exception Invalid terminal type: jline.UnixTerminal when starting console – OlegYch Aug 28 '12 at 03:14