TeamCity Server Logs
TeamCity Server keeps a log of internal activities that can be examined to investigate an issue with the server behavior or get internal error details.
The logs are stored in plain text files in a disk directory on the TeamCity server machine (usually in <TeamCity Server home>/logs
). The files are appended with messages when TeamCity is running.
While the server is running, the logs can be viewed in the web UI on the Server Logs
tab of Administration | Diagnostics section.
General Logging Description
TeamCity uses log4j library for the logging and its settings can be log4jConfiguration.
By default, log files are located under the <TeamCity Server home>/logs
directory.
The most important log files are:
| General server log |
---|---|
| Log of user-initiated and main build-related events |
| Log of VCS-related activity |
| Notifications-related log |
| (off by default) Cloud-integration (Amazon EC2) -related log |
| (off by default) Log of SQL queries, see Reporting Issues |
| (off by default) Log with messages related to NTLM and other authentication for HTML requests |
| (off by default) Log of messages sent by the server to agents and IDE plugins via XML-RPC |
| (off by default) Log related to individual file content requests from VCS |
| (off by default) REST-API related logging |
| (off by default) Notification templates processing-related logging |
| (off by default) Logging related to agent push operations |
| (off by default) Logging related to personal builds processing on the server |
| (off by default) SVN integration log |
| (off by default) TFS integration log |
| (off by default) StarTeam integration log |
| (off by default) ClearCase integration log |
| LDAP-related log |
| (off by default) logs of back-up/ restore/ migration performed with Migrating to an External Database |
Other files can also be created on changing logging configuration.
Some of the files can have ".N" extensions - that are files with previous logging messages copied on main file rotation. See maxBackupIndex for preserving more files.
Logging-related Diagnostics UIviewLogs
Users with System Administrator role can view and download server logs right from TeamCity web UI under Administration | Diagnostics | Server Logs.
Also, users with System Administrator role can change active logging preset for the server logs for the server logs under Administration | Diagnostics page, Troubleshooting, Debug logging subsection. Choosing a preset will change logging configuration until the server is restarted (see TW-14313). New presets can also be uploaded via Diagnostics | Logging Presets.
The available presets are configured by the files available under <TeamCity Data Directory>/config/_logging
directory with .xml extension. New files can be added into the directory and existing files can be modified (using TeamCity Data Directory).
Changing Logging Configuration
While TeamCity is running, logging configuration for the server can be switched to a loggingPreset.
If it is not possible to enable debug logging mode via logging presets (e.g. to get the logging during server initialization) or to make persistent changes to the logging, you can backup the conf/teamcity-server-log4j.xml
file and copy/rename the <TeamCity Data Directory>/config/_logging/debug-general.xml
file over conf/teamcity-server-log4j.xml
before the server start.
Changing Logging Settings
If you want to fine-tune the log4j configuration, you can edit <TeamCity Server home>/conf/teamcity-server-log4j.xml
file (for .war TeamCity distribution, see General-Logging-Configuration). If the server is running, the log4j configuration file will be reloaded automatically and the logging configuration will be changed on the fly (some log4j restrictions still apply, so for a massive change consider restarting the server).
Most useful settings of log4j configuration: To change the minimum log level to save in the file, tweak the "value" attribute of the "priority" element:
<category ...> <priority value="INFO"/> ...
The logs are rotated by default. When debug is enabled, it makes sense to increase "value" attribute of "maxBackupIndex" element to affect the number of preserved log files. While doing so, please ensure there is sufficient free disk space available.
<appender ...> <param name="maxBackupIndex" value="10"/> ...
For detailed description of maxBackupIndex and other supported attributes, see http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/RollingFileAppender.html.
Reading Logs
Each message has a timestamp and level (ERROR, WARN, INFO, DEBUG).
e.g.:
[2010-11-19 23:22:35,657] INFO - s.buildServer.SERVER - Agent vmWin2k3-3 has been registered with id 19, not running a build
ERROR means an operation failed and some data was lost or action not performed. Generally, there should be no ERRORs in the log.
WARNs generally means that an operation failed, but will be retried or the operation is considered not important. Some amount of WARNs is OK. But you can review the log for such warnings to better understand what is going OK and what is not.
INFO is an informational message that just reports on the current activities.
DEBUG is only useful for issue investigation. e.g. to be analyzed by TeamCity developers.
General Logging Configuration
By default TeamCity searches for log4j configuration in a ../conf/teamcity-server-log4j.xml
file (this resolves to <TeamCity Server home>/conf/teamcity-server-log4j.xml
for TeamCity .exe and .tar.gz distributions when run from "bin"). If no such file is present, the default log4j configuration is used. The logs are saved to ../logs
directory by default.
The configuration options values can be changed via corresponding "log4j.configuration" and "teamcity_logs" JVM options or Configuring TeamCity Server Startup Properties. For example:log4j.configuration=file:../conf/teamcity-server-log4j.xml
and teamcity_logs=../logs/
Default values can be looked up in the bin/teamcity-server
script available in the .exe and tar.gz distributions.
If you start TeamCity by the means other than the bundled teamcity-server
or runAll
scripts, please make sure to pass the above-mentioned options to the server JVM. See also the Installing and Configuring the TeamCity Server on installing TeamCity into not bundled web server.
The default teamcity-server-log4j.xml
file content can be found in the .exe and tar.gz distributions. The one with debug enabled can be found under /config/_logging/debug-general.xml
name after server's first start. See also sample file.