Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the raw build log from a TeamCity build?

Tags:

teamcity

Is it possible to get the raw build log from a TeamCity build? I've written a custom test runner that gets run as a commandline build step and reports test results back by printing ##teamcity... lines to stdout. The build log from TeamCity seems to be stripping these out when it recognises them. I'd like to see the raw output to help debug my test runner.

Update: Apparently this simply isn't possible. neverov (I assume Dimitry Neverov of JetBrains?) has explained this and given a workaround so I've accepted his answer.

like image 241
Peter Graham Avatar asked Jul 06 '12 00:07

Peter Graham


People also ask

How do I check my TeamCity build history?

To view the history of builds in the current configuration, click previous and next links in the upper right corner of Build Results. Click All history link to open the History tab.

How do you find a build log?

On the menu bar, choose Tools > Options. On the Projects and Solutions page, choose the Build and Run page. In the MSBuild project build output verbosity list, choose one of the following values, and then choose the OK button. Displays a summary of the build only.

What is a build log?

A build log is an enhanced console output of a build. It is represented by a structured list of the events which took place during the build. Generally, it includes entries on TeamCity-performed actions and the output of the processes launched during the build.

How do you clean builds in TeamCity?

You can also enable automatic cleaning the sources before every build, if you check the option Clean all files before build on the Create/Edit Build Configuration> Version Control Settings page. If this option is checked, TeamCity performs a full checkout before each build.


4 Answers

You can download it by clicking "Download full build log" on build log page.

like image 93
neverov Avatar answered Nov 04 '22 11:11

neverov


Great answers here before me. I would add that your TeamCity master holds log files for the builds, and you can get them on the command line.

Have a look in <TeamCity Data Directory>/system/artifacts/<project ID>/<build configuration name>/<internal_build_id>/.teamcity/logs.

This mattered to me because

  1. The logs on the TeamCity agents were getting removed after a day or so, but the logs on the master were still available.
  2. I wanted to grep them on the machine itself without having to download multiple, sizeable log files or use my web browser to make multiple page views.
like image 29
JellicleCat Avatar answered Nov 04 '22 12:11

JellicleCat


You can see the raw output from the build agent by looking in the agents /logs directory. This shows the unparsed data that is being hidden on the build output shown in the TeamCity console.

For example c:\TeamCity-Agent\logs\teamcity-build.log.

like image 24
Ian Battersby Avatar answered Nov 04 '22 12:11

Ian Battersby


I see that this question was asked long time ago (almost 10 years ago) but nothing changed in TeamCity.

I faced similar issue with test reporter and found a way to get raw log without connecting to build agent and getting it from there (it may be difficult). My solution does not cover the whole build log, but can be helpful when step is run via custom script in Build Steps.

So the solution is to add | tee e2e_raw.log into required build step script. For example we run tests in Docker by running docker-compose command: enter image description here

tee will duplicate all the output into the file. Original output will be the same and will be parsed by TeamCity as usual.

You should also add a line into artifacts field to make build able to collect newly created artifact (Build General settings): enter image description here

After that you will see a new archive in artifacts tab with raw log for this build step: enter image description here

enter image description here

like image 30
DJ-Glock Avatar answered Nov 04 '22 11:11

DJ-Glock