AzureFeeds - All your Azure feeds in one place.

Sponsors

Wednesday, April 21, 2010

Capturing Filtered Windows Events with Windows Azure Diagnostics

by Steve Marx via blog.smarx.com - cloud development blog on 4/21/2010 5:33:22 PM

If you download the source code for my Hosted Web Core Worker Role, you’ll see a few lines of code which configure Windows Azure Diagnostics to capture Windows Events generated by Hosted Web Core:

var cfg = DiagnosticMonitor.GetDefaultInitialConfiguration();
// HWC uses the event log to indicate what's broken.
// This config setting is really handy when debugging bad config.
cfg.WindowsEventLog.DataSources.Add("Application!*[System[Provider[@Name='HostableWebCore']]]");
diagnosticMonitor = DiagnosticMonitor.Start("DiagnosticsConnectionString", cfg);

When you add a Windows Event log data source, you get to specify an XPath selection criterion for the events you want to log. The Windows Azure Diagnostics documentation gives a simple example and then links to Consuming Events for more details. In neither place could I find examples like what I wanted (listening to events from a particular provider).

I was able to figure out what to put in that string by creating a custom view in the Windows Event Viewer on my laptop and then switching to the XML view to see the XPath:

image

image It wasn’t hard from there to derive the right syntax to pass to WindowsEventLog.DataSource.Add.

email it!bookmark it!digg it!

Original Post: Capturing Filtered Windows Events with Windows Azure Diagnostics

Legal Note

The content of the postings is owned by the respective author. AzureFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on AzureFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.

Advertise with us