Question

When I run Play commands, the logs come out nicely colored and clean in the terminal, but when I build my application in Jenkins, the logs there show the color codes, rending them amazingly hard to read.

Command-line logs:

[info] ApplicationSpec
[info] Application should
[info] + send 404 on a bad request
[info] x render the index page
[error]    '401' is not equal to '200' (ApplicationSpec.scala:25)
[info] Total for specification ApplicationSpec
[info] Finished in 134 ms
[info] 2 examples, 1 failure, 0 error
[error] Failed: Total 3, Failed 2, Errors 0, Passed 1
[error] Failed tests:
[error]     ApplicationSpec
[error]     IntegrationSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 23 s, completed Mar 26, 2014 10:00:34 AM

Jenkins logs:

[0m[[0minfo[0m] [0mApplicationSpec[0m
[0m[[0minfo[0m] [0mApplication should[0m
[0m[[0minfo[0m] [0m[32m+[0m send 404 on a bad request[0m
[0m[[0minfo[0m] [0m[33mx[0m render the index page[0m
[0m[[31merror[0m] [0m   '401' is not equal to '200' (ApplicationSpec.scala:25)[0m
[0m[[0minfo[0m] [0mTotal for specification ApplicationSpec[0m
[0m[[0minfo[0m] [0m[34mFinished in 229 ms[0m[0m
[0m[[0minfo[0m] [0m[34m2 examples, 1 failure, 0 error[0m[0m
[0m[[31merror[0m] [0mFailed: Total 3, Failed 2, Errors 0, Passed 1[0m
[0m[[31merror[0m] [0mFailed tests:[0m
[0m[[31merror[0m] [0m   ApplicationSpec[0m
[0m[[31merror[0m] [0m   IntegrationSpec[0m
[0m[[31merror[0m] [0m(test:[31mtest[0m) sbt.TestsFailedException: Tests unsuccessful[0m
[0m[[31merror[0m] [0mTotal time: 6 s, completed Mar 25, 2014 2:28:01 PM[0m

As you can see, the Jenkins output still has the same content, but the color codes make it so noisy that it's really hard to figure out what's going on.

I've found limited information on how to turn color codes off for the SBT tool, but I can't figure out how to pass this in through the play commands when running my builds through Jenkins.

Was it helpful?

Solution 2

De facto I was curious also (have the same problem) so checked suggestion you sent :)

Answer is:

play -Dsbt.log.noformat=true dist

Or (if more params should be sent to console like non-default port no.) as usually:

play -Dsbt.log.noformat=true "~run 9123"

OTHER TIPS

Or you can install Ansi-Color Jenkins plugin, and actually have the colors in your Jenkins's log

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top