Semantically Speaking...

  • Comments 2

So I've temporarily escaped from Azure to lend a hand with, as Monty Python would say, something completely different. And it's a bit like coming home again, because I'm back with the Enterprise Library team. Some of them even remembered me from last time (though I'm not sure that's a huge advantage).

Enterprise Library has changed almost beyond recognition while I've been away. Several of the application blocks have gone, and there are some new ones. One even appeared and then disappeared again during my absence (the Autoscaling block). And the blocks are generally drifting apart so that they can be used stand-alone more easily, especially in environments such as Azure.

It's interesting that, when I first started work with the EntLib team, we were building the Composite Application Block (CAB) - parts of which sort of morphed into the Unity Dependency Injection mechanism. And the other separate application blocks were slowly becoming more tightly integrated into a cohesive whole. Through versions 3, 4, and 5 they became a one-stop solution for a range of cross-cutting concerns. But now one or two of the blocks are starting to reach adolescence, and break free to seek their fortune in the big wide world outside.

One of these fledglings is the block I'm working on now. The Semantic Logging Application Block is an interesting combination of bits that makes it easier to work with structured events. It allows you to capture events from classes based on the .NET 4.5 and above EventSource class, play about with the events, and store them in a range of different logging destinations. As well as text files and databases, there's an event sink that writes events to Azure table storage (so I still haven't quite managed to escape from the cloud).

The latest version of the block itself is available from NuGet, and we should have the comprehensive documentation available any time now. It started out as a quick update of the existing docs to match the new features in the block, but has expanded into a refactoring of the content into a more logical form, and to provide a better user experience. Something I seem to spend my life doing - I keep hoping that the next version of Word will have an "Auto-Refactor" button on the ribbon.

More than anything, though, is the useful experience it's providing in learning more about structured (or semantic) logging. I played with Event Tracing for Windows (ETW) a few times in the past when trying to consolidate event logs from my own servers, and gave up when the level of complexity surpassed by capabilities (it didn't take long). But EventSource seems easy to work with, and I've promised myself that every kludgy utility and tool I write in future will expose proper modern events with a structured and typed payload.

This means that I can use the clever and easy to configure Out-of-Process Host listener that comes with the Semantic Logging Application Block to write them all to a central database where I can play with them. And the neat thing is that, by doing this, I can record the details of the event but just have a nice useful error message for the user that reflects modern application practice. Such as "Warning! Your hovercraft is full of eels...", or maybe just "Oh dear, it's broken again..."

  • Since you are working with Azure and SLAB, it would be great is someone can do an article on how to best pair a website that uses ETW hosted in Azure Websites with SLAB out-of-process pushing to Azure table.  Sure I can do in-process with the SLAB, but out-of-process is where it is at. Or tell me it is not possible.

    I think it is easier to do with Cloud Services but even that not seen great articles/blogs.    

    What is the role of WAD in this? Do I use WAD at all?  Seems that ETW is second rate when it comes to Azure, even though WAD is built on top of it.

  • Thanks Cleve. As far as I can ascertain, you can't run the Out-of-Process Host in Azure Websites. The problem is not getting it started (there are kludges to run a startup task in Websites) but the fact that you can't run it with elevated (admin) privileges - which the OOP Host requires.

    It should be possible to run the OOP Host in a Cloud Service using something like the following:

    <ServiceDefinition name="MyService" xmlns="...">

      <WebRole name="WebRole1">

        <Startup>

          <Task commandLine="[installation-path]\SemanticLogging-svc.exe" executionContext="elevated" taskType="background">

          </Task>

        </Startup>

      </WebRole>

    </ServiceDefinition>


    You should have no problems running the OOP Host in an Azure Virtual Machine. 

    I don't think Azure Active Directory will be any help. The issue is the requirement for administrative permission to access ETW.

     

Page 1 of 1 (2 items)
Leave a Comment
  • Please add 5 and 5 and type the answer here:
  • Post

Semantically Speaking...