Brian Harry had blogged before on how we are using the activity logging on our Team System data-tier to actually measure load on our Team Foundation Server.
How to enable logging
TFSActivityLogging is a databsae created on the DT (data-tier) of TFS. To use it first you need to enable the logging. To do that locate the top level web.config file on the TFS. Its usually in some place like %ProgramFiles%\Microsoft Team Foundation 2005\Web Services\Web.config . Search for CommandLogging in the file and set it to something like Normal. After this you are set to go and all commands will be logged in the TFSActivityLogging database.
How to see the log
Open SQL Server Management Studio and run the simple SQL query select * from tbl_Command against this TFSActivityLogging database. You can also do this directly from the command prompt using T-SQL. Follow the steps below to do this
- bring up a command prompt
- run sqlcmd -S localhost -E
- type select * from TFSActivityLogging.dbo.tbl_Command
What you can do with it
This log is used by us for various purpose including calculating load and also determining usage-pattern. If you have access to the DT you are next to God and you can also potentially snoop on other users. I'll take a simple example. Last time I had posted a Rss feed generator for Team Build. I just wanted to check if people are really using it. Since I know calls to my feed generator will result in calling the web-method GetListOfBuilds I ran the following command
select * from tbl_Command where tbl_Command.Command = 'GetListOfBuilds'
This gets me something like below
4994 TFS Build GetListOfBuilds 0 2005-12-20 10:11:24.920 2015309 ArthurDent 18.104.22.168 Mozilla/4.0 NULL
5001 TFS Build GetListOfBuilds 0 2005-12-20 10:13:24.213 892921 Trillian 22.214.171.124 Team Foundation (devenv.exe) NULL
5016 TFS Build GetListOfBuilds 0 2005-12-20 10:20:39.750 498415 Slartibartfast 126.96.36.199 RssBandit/188.8.131.52 NULL
5448 TFS Build GetListOfBuilds 0 2005-12-20 10:37:27.690 392972 Beeblebrox 184.108.40.206 RSSOwl/1.2 2005-11-06 NULL
A look into this tells me that Slartibartfast and Beeblebrox did use Rss aggregator to get to the feed. ArthurDent used only web-UI (through a browser) and trillian only uses devenv to get the build details. I can even tell which aggregators are used by Slartibartfast (RssBandit) and Beeblebrox (RSSOwl) and they are in my good books for using my feed generator (you know who you are folks 🙂 ).