如何关闭 Jenkins 日志中的颜色代码?

问题描述 投票:0回答:2

当我运行 Play 命令时,日志在终端中显示颜色漂亮且干净,但是当我在 Jenkins 中构建应用程序时,那里的日志显示颜色代码,使它们非常难以阅读。

命令行日志:

[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

詹金斯日志:

[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

如您所见,Jenkins 输出仍然具有相同的内容,但颜色代码使其变得如此嘈杂,以至于很难弄清楚发生了什么。

我发现关于如何关闭 SBT 工具颜色代码的有限信息,但我不知道如何在通过 Jenkins 运行我的构建时通过

play
命令传递它。

playframework jenkins playframework-2.0 sbt color-codes
2个回答
4
投票

或者你可以安装 Ansi-Color Jenkins 插件,实际上在你的 Jenkins 日志中有颜色


3
投票

事实上我也很好奇(有同样的问题)所以检查了你发送的建议:)

答案是:

play -Dsbt.log.noformat=true dist

或者(如果应该将更多参数发送到控制台,例如非默认端口号):

play -Dsbt.log.noformat=true "~run 9123"
© www.soinside.com 2019 - 2024. All rights reserved.