Viewing TeamCity service messages

4k views Asked by At

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.)

2

There are 2 answers

1
Biswajit_86 On

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).

0
Sergei Voitovich On

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