Viewing TeamCity service messages

老子叫甜甜 提交于 2020-07-09 08:14:49

问题


I'm troubleshooting a build step in TeamCity 9.0.4. The problem seems to lie within the service message output. Is it possible to view these after the build has completed? They are not included in the build log.

The documentation on service messages simply says In order to be processed by TeamCity, they should be printed into a standard output stream of the build. https://confluence.jetbrains.com/display/TCD9/Build+Script+Interaction+with+TeamCity

(To some extent the service messages can be viewed by manually rerunning the build step and monitoring standard output, but this is not always feasible.)


回答1:


The documentation for service message implies that you need to write service messages to standard out/error rather than to a log file. If you write it to standard out, teamcity will automatically pick it up and show it in the **build logs ** tab

What this means is that if you have a

  1. shell script, use echo for your service messages
  2. java class, use System.out.println and so on

Different languages also have different plugins for this , for ex perl has TapHarness.pl to write teamcity messages to the console.

EDIT:

If you want to just view service messages , you can find them in the build logs on the teamcity agent that the build ran on. If you do not find them in the build logs , either the build log has rolled over or you need to increase the verbosity or debug level of your logs(depends on the language).




回答2:


There was a problem which is solved nowdays:

TeamCity now parses service messages inside other service messages, but only if original message was tagged with tc:parseServiceMessagesInside. Example:

##teamcity[testStdOut name='test1' out='##teamcity|[buildStatisticValue key=|'my_stat_value|' value=|'125|'|]' tc:tags='tc:parseServiceMessagesInside']

A link to JetBrains bug tracker: https://youtrack.jetbrains.com/issue/TW-45311



来源:https://stackoverflow.com/questions/30964350/viewing-teamcity-service-messages

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!