Azure - Enable diagnostics for worker/web role

2k views Asked by At

I would like to log every exception that occurs, (MVC cloudapp), in my table storage.

I followed an official tutorial from Microsoft but it seems like they just complicate things too much. Tutorial can be viewed here: https://azure.microsoft.com/sv-se/documentation/articles/cloud-services-dotnet-diagnostics/#how-to-enable-diagnostics-in-a-worker-role

It just feels like it's too much of a hassle just because Azure diagnostics 1.3 isn't supported by default? There's a faster and easier option in the configure window for web/worker role that let's you enable diagnostics but is that only for 1.0?

I just want to log the exceptions in my storage account so Azure Diagnostics 1.0 should be enough, no?

What I've done:

  1. Enabled diagnostics in my worker and web role by clicking on the checkbox in the configure window for the web and worker role.
  2. Specified the storage account credentials.

What I need help with:

No WAD containers are created in my storage account. Are they not supposed to be created after I have enabled and specified the storage account credentials?

Why is it so complicated to enable Azure diagnostics 1.3 compared to 1.0?

What's the difference between worker role diagnostics and web role diagnostics? If I had my app in webrole and caching in worker role.. Is it then logged individually? Do I need to enable them both if I want exception logging for both app and caching?

2

There are 2 answers

2
Gaurav Mantri On BEST ANSWER

To answer your questions:

No WAD containers are created in my storage account. Are they not supposed to be created after I have enabled and specified the storage account credentials?

If you're looking for wad-control-container, then it won't be created. However you should see containers for IIS Logs, Failed Request Logs and Crash dumps if you have enabled that in your diagnostics configuration.

Why is it so complicated to enable Azure diagnostics 1.3 compared to 1.0?

Essentially the diagnostics model has changed. Version 1.0 was plugin model while Version 1.3 is an extension model (It changed from SDK 2.5 when they introduced version 1.2). Whether it is complicated, I think it is debatable. While 1.0 version was rather straight forward and had some capabilities like definining the diagnostics configuration in code, I think 1.3 is a step in right direction. I too felt frustrated with it to begin with but now I am realizing the benefits it offers as I use it more. Some of the benefits that appealed to me are:

  • Pure decalarative model instead of mixed model (Programmatic + Decalarative).
  • Unified approach to collect diagnostics data for both your Cloud Services and Virtual Machines (at this time Windows only).
  • Ability to enable/disable diagnostics configuration on the fly because it is now an extension model.
  • Support for ETW logs.

Some of the things that I don't like in 1.3:

  • Deployment process is rather convoluted if you're not deploying through Visual Studio.
  • Limited tooling support. Only options available to you are either Visual Studio or PowerShell. At this time, Portal (both current and preview) doesn't support it.
  • Deprecated On-Demand Transfer functionality. We use this functionality a lot which is now deprecated as it relies on code-based diagnostics changes.

What's the difference between worker role diagnostics and web role diagnostics?

AFAIK, there's no difference between the two. It all depends on what diagnostics data you want to collect for each role.

If I had my app in webrole and caching in worker role. Is it then logged individually?

Well, yes and no. Each role get it's own diagnostics.wadcfgx file where you define the storage account to store diagnostics data. If you define different storage accounts in each role's wadcfgx file then the data would go into separate storage account. Even if you keep the same storage account, data will have the role name and role instance name so that you can distinguish between different diagnostics data.

Do I need to enable them both if I want exception logging for both app and caching?

Yes. You would need to enable them both.

0
FrictionFree On

There's a simple PowerShell script on GitHub to enable WAD on either a Cloud Service (Web/Worker Role) or a VM with zero hassle. At the same time it will also configure WAD to send your logs to Visual Studio Application Insights so you can search & query efficiently.