How to get live traces from Windows Azure
I would like to share with you this new addition to Windows Azure features. It simply allows you to get a ‘live’ traces from your applications deployed to Windows Azure as WebSites.
Disclaimer
Although we have done extensive tests to ensure product quality, it is, as of today (12/19/12), released as a Preview feature. We would like you to try it and, most importantly, hear your feedbacks or suggestions.
Overview
Diagnostic tracing is one important aspect to help identify and investigate issues. In .NET world, application would generally use System.Diagnostics.Trace to write traces to a file. Similarly in nodejs applications, console.log provides a way to trace to the console. Once these applications get deployed to Windows Azure, one may be able to retrieve those traces as follow.
- Using ftp to extract all LogFiles based on Azure File Structure.
- If git is enabled for the site, one can also get a zip of those LogFiles by connecting to /dump endpoint of the git service (See getting git service log section).
A ‘live’ tracing is complimenting these by allowing user to view the traces as it happens!
Let’s try it
This demo illustrates what you need to as an application writer to do tracing and, eventually, how to get live traces.
- Sign up for Windows Azure if you don’t already have.
- Log in Windows Azure,
- Create a new WebSite
- Navigate to the site QuickStart or DashBoard page
- Click ‘Set up Git publishing’
- Clone this simple nodejs application from https://github.com/suwatch/nodejs01.git. The application blindly traces (console.log) every requests.
- Git push it to your site. See publishing WebSites with git.
- Connect the to logstream endpoint using simple curl.
$ curl --user yourusername https://yoursite.scm.azurewebsites.net/logstream
Enter host password for user 'yourusername':
Welcome, you are now connected to log-streaming service.
6. Browse to your site and you will see live stream in action!
Wed Dec 19 2012 14:33:18 GMT-0800 (Pacific Standard Time): request for /
Wed Dec 19 2012 14:33:21 GMT-0800 (Pacific Standard Time): request for /
Wed Dec 19 2012 14:33:22 GMT-0800 (Pacific Standard Time): request for /
Play around with it by adding more traces and see it live. You can also watch the screen cast by @davidebbo.
Yet to come
The live trace is only available if one enables git publishing for the site and only for nodejs application out of the box. Good news is, for Spring’13 Windows Azure release, it will be available to all sites as well as for .NET application. If you are eager to try the live stream with .NET application, I have written a simple AzureTraceListener . Simple clone and follow its readme instruction.