Diagnostics of Windows Azure Web Sites – Built-in Diagnostic Features

Introduction

I have been developing an MVC 4.0 web application that is hosted in Azure platform. In this first part of 2-blog post series, I will talk about leveraging built-in logging and tracing features of Windows Azure platform.

 

Context

Use of built-in diagnostic features requires 3 main steps:

Step 1: Activation of built-in Windows Azure diagnostics features

  1. Login to Azure management portal with your Windows Account
  2. Select your web site
  3. Click ‘Configure’ on the top menu
  4. Turn it On those you wished to capture under Diagnostic tab menu
  5. Click Save.

Please see the image on the right a reference.

Now, you should be able to see the deployment and ftp account on the dashboard as seen in the 2nd image on the right.

AzureDiagnosticsTurnOn
AzureFtpAccountReset3

     

Step 2: Downloading and analysis of log files

Once Step 1 completed, Windows Azure starts logging diagnostics events for the site. To see them, you need to create an FTP deployment account and FTP program to download the log files as detailed below:

  • Click on Quick Start icon (the one next to Dashboard link at the top menu)
  • Click on ‘Reset deployment credentials’ link in the Publish your app section

  • AzureFtpAccountReset1

  • Enter username and password information for ftp account
  • Click Save icon to finish.

AzureFtpAccountReset2

  • Download an FTP client application – I use FileZilla, an open source FTP program (Alternatively, you can use a Windows or Internet browser too).
  • Provide the host address, ftp username and password, as notated on the right image.

AzureFtpFileZilla

 

 

Step 3: Analysis of diagnostic logs

In Step 1, we talked about diagnostic features comes with Windows Azure for web sites:

  • Web Server Logging –they are resembled to IIS logs and are located under LogFileshttpRawLogs with .log extensions. Each request (success or failure) is recorded along with these log fields: # date time s-sitename cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs-host sc-status sc-substatus sc-win32-status sc-bytes cs-bytes time-taken. Readable, but you can get good reports by using LogParser tool.
  • Detailed Error Messages – they are in LogFilesDetailedErrors folders and can give you details on errors occurred in the application.
  • Failed Request Tracing – they come with XML(document) and XSLT (for transformation) and can give you further details for failed responses.

image

Partial image from the tracing document for this demo.

 

Conclusion

Windows Azure comes with built-in diagnostic features that you can utilize to monitor your applications running on Windows Azure. The diagnostic features can be useful to report page-related statistics (server logs), and to diagnose errors (error details) and performance issues (traces) in high-level. For detailed logging, you need to come up with your custom solution.

Happy clouding! and stay tune for my next post on how-to write custom messages to logs in Windows Azure web sites.