Wednesday, November 19, 2008

Debugging Azure Cloud Applications

At some point you will need to debug your Azure cloud applications. Here is some guidance on what the options are.

Local Debugging. First off, the general hope is that you'll catch and fix problems on your local box long before you place anything into the cloud. Locally you can use familiar tools such as the Visual Studio debugger and event logs and other tools to get to the root of problems.

Application Logs. However, it's possible to have an app that works locally that doesn't work when deployed to the cloud. What do you do then? You look at the logs for your application, that's what you do. Unfortunately this is something of an involved process today:
  1. You have to first find the Copy Logs button, which is lurking under your Configure button on the Azure portal. This hasn't been obvious to everybody.
  2. Clicking Copy Logs will copy your logs to your storage account.
  3. Lastly you need to run a program to read your logs out of cloud storage so you can view them. There is a sample in the Azure SDK called CloudDrive that does this. It is an exension to PowerShell. There is some work involved to configure, build it, and get it going the first time around.

No doubt this will become more streamlined over time, but it's what we have to work with today. Benjamin Day has written an excellent post that gives a blow-by-blow account of exactly what you need to do, including screen captures. You can also instrument your application to write to those logs using the RoleManager.WriteToLog method.

MSDN Forums. MSDN has a very good set of forums set up with several Azure categories. I've mostly been interacting with the Windows Azure forum, and I've found it to be a great place to go to get answers or help others. Moreover, Microsoft personnel have been fantastically responsive and helpful. So if the above methods don't help, post your problem to the appropriate forum. Between Microsoft and the community you'll likely get some help.

No comments: