Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (22 sloc) 1.15 KB

Overview

This implements the TraceListener intended for .NET applicaiton deployed to Windows Azure as WebSites.

Setup

  • Simple clone and build.cmd to build the project.
  • Add AzureTraceListener.dll as an Assembly reference to your .NET project.
  • Make sure you commit this assembly as part of your repo.

Include AzureTraceListener as a TraceListener to your app

You may do one of the following.

  • Imperative thru codes in Application_Start. It is important that the path to LogFiles is ..\..\LogFiles\<yourapp>.

    Trace.Listeners.Add(new AzureTraceListener.AzureTraceListener(@"..\..\LogFiles\aspnet01"));

  • Add to web.config

    <system.diagnostics>  
      <trace autoflush="true" indentsize="4">
        <listeners>
          <add name="TextListener"
            type="AzureTraceListener.AzureTraceListener, AzureTraceListener"
            initializeData="..\..\logFiles\aspnet01" />
          <remove name="Default" />
        </listeners>
      </trace>
    </system.diagnostics>
    

That's it. You should be able to use System.Diagnostics.Trace in your application and see the trace files.

Jump to Line
Something went wrong with that request. Please try again.