Logging modules for ASP.NET (MVC) and also for Windows Azure

I was just reading through Scott Hanselman’s post about ELMAH and this sounds like a great idea.  Getting a easy to consume report of all of your exceptions is a wonderful thing, especially when you add in that you can get it as an RSS feed, an email or a web site.  You can check out ELMAH or read through his post to get a lot of details on it.

The web site looks like this:

This also got me thinking about Windows Azure and some of the logging that has been done already for that.  So I wanted to highlight one of the projects here and talk about what it does.  It is called Azure Application Monitor

This allows you to see how much time and memory your instance is using.  After you integrate this into your application, you will get a report like:

AzureMonitor.jpg

It is easy to add this to your application.

  1. Download the application

  2. Add the following line to your code.  If you are adding it to a WebRole, add it in the Page_PreRender() function.  Or in the Start() of a WorkerRole, changing it to WorkerRole below:

     Neudesic.Azure.AzureMonitor.Start("AppName", "WebRole");
    
  3. Be sure you have the TableStorageEndpoint configuration setting configured.

  4. Create a PerfCounterUpdateInterval configuration setting and set the value (the value is in ticks (1000 ticks = 1 second)

  5. Test and deploy your application

To view the data, you need to configure the AzureMonitor so that it points to your TableStorageEndpoint

As for what all it tracks, here is the list:

Application Name (you supply this in your code)

Role Name (you supply this in your code)

Machine Name

Process ID

Thread count

Handle count

Total processor time

User processor time

Private memory size

Non-paged memory size

Paged memory size

Paged system memory size

Peak paged memory size

Peak virtual memory size

Peak working set

Page file usage

Peak page file usage

Non-paged Pool Usage

Local machine time

Process local start time

It is rather easy to add more stuff to this as the code is available from the projects location.

One a side-note, if you want to see what data you have in your Blobs, Queues and Tables, there is an updated version of Azure Storage Explorer available now.  From that site:

The most current release of Azure Storage Explorer, version 2.0, has several improvements over the original version:

  1. The UI is WPF-based and has Outlook-style navigation.
  2. Multiple storage accounts are supported, and you can change your storage account details directly in the tool.
  3. In addition to text and byte views of items, blob items that are pictures can be viewed as images.

Azure Storage Explorer 2.0 does not presently allow you to act on storage items. This capability is being considered for a future update.

Let me know what you think or if you use any other tools for ASP.NET or Windows Azure.