開啟TFS Build Service Log

前天提過的TFS Build Queue卡單今天再度上演,一樣又是重啟TFS Build Service才解決,由於已非偶發罕例,決定展開調查。由事件檢視器查到一筆發生在卡單前一刻的可疑錯誤,Build 1257號,正好是被卡住1258號的前一筆,訊息為An error occurred while calling tracking participants causing the instance to be aborted. 而回頭檢查前天出錯前也有一筆一模一樣的錯誤訊息,推測極可能是導致Queue停止運作的元凶。

我沒找到方法由數字1257反查是哪個專案及編譯結果,只好回歸土方法-逐一偵訊詢問關係人,最後找出失敗建置的Log,確認建置的部署步驟發生檔案複製錯誤,但單純建置失敗為何導致Build Service故障則是個謎。想進一步調查卻苦無線索,爬文得知TFS Build Service可以開啟Log以保留更多偵錯資訊。網路上找到不少教學(),教導修改TFSBuildServiceHost.exe.config設定BuildServiceTraceLevel及TeamFoundationTextWriterTraceListener 的方法,我找到config,發現已內附被<!-- -->註解掉與教學文相同的<system.diagnostics>,立即取消註解,指定Log路徑,但試了好久都不成功,Log檔始終沒出現。再爬文,才發現被擺了一道,Microsoft Connect上有一則Issue Report

This is a feature that had been improved with TFS 2012, and the MSDN documentation for it can be found at
http://msdn.microsoft.com/en-us/library/dd723544.aspx#events
(Manage Your Build System, Use event logs to diagnose problems)

In short, all logging is now available in the Event Viewer, and this can be accessed from the Team Foundation Server Administration Console in the Build Configuration section. As described in the referenced MSDN page, increasing levels of detail can be found in the recent events, operational log, and analytic log (which must first be enabled). Please take a look and let us know if you have any further problems.

Our apologies for the confusion regarding this change. Obviously the leftover comments in the TFSBuildServiceHost.exe.config file regarding trace logging were misleading, and we’ll have those removed in a future release.

意思是從TFS2012起,<system.diagnostics>只用來控制Log詳細度,Log不再寫成檔案而是改存入Windows事件(說實在話,寫成Event是比Log檔方便很多)。TFSBuildServiceHost.exe.config 設定檔殘留被註解掉的TeamFoundationTextWriterTraceListener 是個陷阱,真是抱歉!orz

照著MSDN文件說明,在事件檢視器開啟「Show Analytic and Debug Logs」:

找到Event Viewer/Application and Service Logs/Microsoft/Team Foundation Server/Build Services/Analytic按右鍵選單「Enable Log」:

重啟TFS Build Service後就會啟用記錄功能,我試著排入一個編號1258的建置,在事件中果然找到1258號對應到的建置定義資訊。下回再遇到狀況就會有多一點線索可追,至於能不能抓出卡單之謎?就讓我們拭目以待。

歡迎推文分享:
Published 24 March 2016 11:35 PM 由 Jeffrey
Filed under:
Views: 1,766



意見

沒有意見

你的看法呢?

(必要的) 
(必要的) 
(選擇性的)
(必要的) 
(提醒: 因快取機制,您的留言幾分鐘後才會顯示在網站,請耐心稍候)

5 + 3 =

搜尋

Go

<March 2016>
SunMonTueWedThuFriSat
282912345
6789101112
13141516171819
20212223242526
272829303112
3456789
 
RSS
創用 CC 授權條款
【廣告】
twMVC

Tags 分類檢視
關於作者

一個醉心技術又酷愛分享的Coding魔人,十年的IT職場生涯,寫過系統、管過專案, 也帶過團隊,最後還是無怨無悔地選擇了技術鑽研這條路,近年來則以做一個"有為的中年人"自許。

文章典藏
其他功能

這個部落格


Syndication