TeamCity Cloud 2023.09 Help

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. TeamCity captures the processes output and stores it in an internal format that allows for hierarchical display.

Viewing Build Log

The log of a specific build is available for browsing on the Build Results page.

The Tree view is the most capable view provided in the web UI. By default, all messages are displayed. Using the View drop-down menu, you can switch from all messages to viewing errors separately, or you can choose Important messages to see the log filtered by "error" and "warning" statuses. You can also use the "Verbose" view level and download a raw build log using the corresponding link.

You can download a full build log in the textual form or as a .zip archive from the Build Results page by clicking the Download full build log link in the upper right corner.

Integration with Log Analysis Tools

If you want 3rd-party log analysis tools to ingest logs generated by TeamCity builds, set up the integration that targets the following URL:

  • http(s)://<SERVER_URL>/downloadBuildLog.html?buildId=<ID> — if your log analysis tool authenticates in TeamCity using an access token.

  • http(s)://<SERVER_URL>/httpAuth/downloadBuildLog.html?buildId=<ID> — if the tool authenticates using the standard username/password credentials.

For example, a request to the following URL will result in downloading a log for a build whose internal ID is "4102":

http://localhost:8111/downloadBuildLog.html?buildId=4102

Note that build IDs are unique values that are not equal to build numbers. You can obtain a build ID from the build results page URL (the Integer value before the ?buildTab=... parameter).

Internal Build ID

To retrieve build IDs via REST API, send a request to the /app/rest/builds endpoint. You can use various locators to search for specific builds. For example, the following request returns builds that belong to the specific build configuration:

/app/rest/builds?locator=buildType:ProjectName_ConfigName

Additional URL Parameters

Obtain Build Log as Plain Text

A request to the http(s)://<SERVER_URL>/downloadBuildLog.html?buildId=<ID> URL returns a response with the Content-Disposition header set to "attachment":

Content-Disposition: attachment; filename*=UTF-8''ProjectName_ConfigName_BuildNumber.log;

This header forces modern browsers to download the required build log as an attachment. If you want to open the contents of a log in a browser tab without downloading it, append the &plain=true parameter to your URL. For example:

http://localhost:8111/downloadBuildLog.html?buildId=4102&plain=true

The contents of the target build log is available as plain text inside the response body.

Download Archived Log

Add the archived=true parameter to the URL to download the target log file as a .zip archive. For example:

http://localhost:8111/downloadBuildLog.html?buildId=4102&archived=true

Modify the DateTime Pattern

By default, timestamps in a build log are written in the "HH:mm:ss" format. You can add the dateFormat=<value> parameter to the URL to modify the DateTime pattern. Custom patterns must follow the Java SimpleDateFormat specification.

For example:

http://localhost:8111/downloadBuildLog.html?buildId=4102&dateFormat=yyyy-MM-dd%20HH%3Amm%3Ass%20zz

Customizing Log Output

You can modify the log output using service messages. This includes grouping the log entries in blocks, handling parallel message flows, changing the severity of a log message, and so on.

Build Log Size

It is recommended to keep the build log small and tune build scripts not to print too much into the output. Large build logs are hard to view in the browser and are loading TeamCity infrastructure piping build messages from the agent to the server while the build is running.

It is recommended to print into the output only the messages required to understand the build progress and build failures. The rest of the information should be streamed into a log file and the file should be published as a build artifact. A "good" build log size is megabytes at most.

Partial Build Log Display

When opening large build logs, TeamCity displays a part of it to avoid browser hanging. You can view the full build log on clicking the corresponding link.

The display threshold is set to 5M characters.

ANSI-style Coloring in Build Log

TeamCity build logs render clickable hyperlinks and support ANSI-style escape color codes by default: if your tool produces a colored console output, you will see in the build log in TeamCity. See the related feature request for the full list of supported sequences.

Last modified: 05 September 2023