Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
AzureTraceListener
C#
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
Properties
.gitignore
AzureTraceListener.cs
AzureTraceListener.csproj
AzureTraceListener.sln
README.md
build.cmd

README.md

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.

Something went wrong with that request. Please try again.