Wednesday, January 28, 2009

Do you know what TFS is doing?

By default you won't. But you can easily change that! Go to your application tier and find where the TFS web services are located. Typically this will be

%PROGRAM FILES%\Microsoft Visual Studio 2005 Team Foundation Server\Web Services

Open the web.config file there and find the setting for "commandLogging."

        <!--  WEB METHOD LOGGING
Specify web method logging behavior. The default value is 'None'. Valid
values and their meaning are:
None (Never log web methods)
OnError (Include web methods that encounter errors)
ReadWrite (Include web methods that change database(s))
Normal (Above, plus web methods that don't change database(s))
LightWeight (Above, plus web methods that have minimal database access)
All (Above, plus always include web method request details when avail.)
-->
<add key="commandLogging" value="None"/>


Now change the value from "None" to "Normal" and logging is enabled. Swell, but how can we see the log? You have to use SQL Management Studio (or the sql command line). So, fire up SQL Management Studio and connect to your TFS data tier. There is a database appropriately named TFSActivityLogging - that's where all the logging happens. Use the following SQL to read all the logged activity:



select *
from tbl_command



You'll get the following columns:




  • CommandId - identity column


  • Application - which TFS application handles the web service call


  • Command - which web service command was issued


  • Status - uh...status.


  • StartTime - when the command was called


  • ExecutionTime - how long the command took to execute


  • IdentityName - name of the identity who issued the command


  • IPAddress - the IP address of the identity who issued the command


  • UserAgent - the user agent string of the executable that invoked the command. For example, you'll see values containing devenv.exe which corresponds to Visual Studio.


  • UniqueIdentitfier - GUID used to correlate multiple records. There are some commands, like check-in, that cause multiple web methods to be invoked. Nullable.


  • CommandIdentifier - name of the command line tool invoking the web method. Nullable.



Now you'll know what is happening with your TFS and who is requesting it. Enjoy!


No comments: