Dumping logs from the Azure Development Fabric

How to view Azure logs (RoleManager.WriteToLog ) when running under the Development Fabric:

  1. Open the Development Fabric and get the deployment id. For example, if the deployment title reads "deployment(26)", the id is "26". 
    devfabric

  2. To dump the logs to an xml file, from a command prompt run csrun.exe with the dumplogs flag

    1. For example, "csrun /dumplogs:26;." will dump the logs for the deployment (26) into the current directory (.)

    2. A log file will be created for each role. For example:

      1. deployment(26).PresenceCloud.PresenceService.0.xml
      2. deployment(26).PresenceCloud.PresenceService_Worker.0.xml
    3. The log contains XML where each <Event> tag corresponds to the calls made by RoleManager.WriteToLog(). For example, the contents of the log look like:

      <?xml version="1.0" encoding="utf-8"?>
      <ServiceDiagnostics
      Service="deployment(26)"
      ServiceDeployment="deployment(26)"
      Role="PresenceService"
      RoleInstance="deployment(26).PresenceCloud.PresenceService.0">
      <Events>
      <Event
      Time="2009-08-13T19:03:11.7620594Z"
      Name="Information"
      Severity="Info"
      ThreadId="5676">
      <EventProperty
      Name="message">Entered Constructor()</EventProperty>
      </Event>
      <Event
      Time="2009-08-13T19:03:11.7645300Z"
      Name="Information"
      Severity="Info"
      ThreadId="5676">
      <EventProperty
      Name="message">Returned from Constructor()</EventProperty>
      </Event>
      </Events>
      </ServiceDiagnostics>

    Note: csrun.exe is a tool provided by the Windows Azure SDK. By default it is installed to C:\Program Files\Windows Azure SDK\v1.0\bin\csrun.exe