In this post, I want to talk about the steps which I typically perform to enable the job agent logs for lab operations.

1. Stop the TFS job agent service. (net stop tfsjobagent)

2.  Enable tracing for Tfs job agent.

  • Take a backup of the tfsjobagent.exe.config file. (It is typically found under C:\Program Files\Microsoft Team Foundation Server 10.0\Application Tier\TFSJobAgent directory on the TFS server machine)
  • Modify the config file in which I typically uncomment the trace listener, modify the path where the logs should be stored, ensure that the account under which job agent service is running has write permission on that path and change the trace level to verbose as highlighted below.

<system.diagnostics>

  <trace autoflush="false" indentsize="4">

<listeners>

      <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Temp\jobagent.log" />

      <remove name="Default" />

</listeners>

  </trace>

  <switches>

    <add name="API" value="0" />

    <add name="Authentication" value="0" />

    <add name="Authorization" value="0" />

    <add name="Database" value="4" />

    <add name="General" value="4" />

    <add name="traceLevel" value="0" />

  </switches>

</system.diagnostics>

3. Start the TFS job agent (net start tfsjobagent)

After these steps the job agent logs are visible in the configured file (c:\temp\jobagent.log).