Search code examples
azureevent-log

EventLog with Azure


I would like to be able to log events with Azure.

Currently, I am using EventLog and .WriteEntry to write it to a log on my local machine. However, I get a Request Error when I upload this to Azure.

I have seen guides that talk about using RoleManager in Microsoft.ServiceHosting.ServiceRuntime, but Microsoft.ServiceHosting.ServiceRuntime is not an available Reference to add (it says "Filtered to: .NET Framework 4, and Microsoft.ServiceHosting.ServiceRuntime is not in the list).

Is there a way to get logging working with .NET Framework 4 references?


Solution

  • ok, first off I always recommend to people to try and abstract away things like writing directly to the event log. Its a system dependency that is better expressed by using a loosely coupled provider. This way a particular piece of code you've created can be used either on premise or in Windows Azure by just changing the provider.

    Secondly, there are security constraints around creating your own event sources. So I'm fairly certain that if this is what you are attempting to do, the operation will throw an exception.

    And finally, the role manager issue isn't a bug. That class was deprecated when Windows Azure went commercial over a year ago. I wrote a short post that talked about it: http://brentdacodemonkey.wordpress.com/2010/03/05/azure-service-configuration-updated-or-%e2%80%9cwhere-did-rolemanager-go%e2%80%9d/

    In your situation, I'd look into creating a simple adapter that writes directly to Azure Table Storage. Then you can let whatever event monitoring process you need periodically check that table. Alternatively, use Azure Storage Queues so you don't have to continually scan the table for new items. :) Just peek at the queue and pull and item when its found there.