Tracing on the server side

gustavo-armenta edited this page Apr 2, 2013 · 1 revision

On your web application, edit web.config

  <system.diagnostics>
    <trace autoflush="true" indentsize="4">
      <listeners>
        <add name="default_traces" type="System.Diagnostics.TextWriterTraceListener" initializeData="default_traces.txt" />
      </listeners>
    </trace>
    <switches>
      <add name="SignalRSwitch" value="All" />
    </switches>
    <sources>

      <source name="Application" switchValue="All">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>

      <source name="Microsoft.Owin.Host.SystemWeb" switchValue="All">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>

      <source name="SignalR.Connection">
        <listeners>
          <add name="traces" />
        </listeners>        
      </source>
      <source name="SignalR.PersistentConnection">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
      <source name="SignalR.HubDispatcher">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
      <source name="SignalR.Transports.WebSocketTransport">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
      <source name="SignalR.Transports.ServerSentEventsTransport">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
      <source name="SignalR.Transports.ForeverFrameTransport">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
      <source name="SignalR.Transports.LongPollingTransport">
        <listeners>
          <add name="traces" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="traces" type="System.Diagnostics.TextWriterTraceListener" initializeData="server_traces.txt" />
    </sharedListeners>
  </system.diagnostics>

On IIS Manager

  • select "Default Web Site"
  • select "Failed Requests Tracing Rules"
  • select "Add..."
  • select "All content (*)", and click "Next"
  • select "Status Codes", type "100-999", and select "Next"
  • select "Finish"
  • restart IIS and you should get logs under the following directories

C:\inetpub\logs\LogFiles\W3SVC1
C:\inetpub\logs\FailedReqLogFiles\W3SVC1