Adding EventIds when logging to WADLogs

This is a great article on how to include an event id in the WADLogs table.

The trick is to use a custom trace source as follows

TraceSource ts = new TraceSource(“My Custom Event Source Name”, SourceLevels.Information);

ts.TraceEvent(TraceEventType.Warning, 102, “This is a test log using trace source”);

and then to configure the azure listener to get this into the appropriate log file:

This gets added to the appropriate system.diagonstics section:

<sources>

<source name=”MyTraceSource” switchName=”sourceSwitch” switchType=”System.Diagnostics.SourceSwitch”>

<listeners>

<add type=”Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ name=”AzureDiagnostics”>

<filter type=”” />

</add>

</listeners>

</source>

</sources>

<switches>

<add name=”sourceSwitch” value=”Warning”/>

</switches>

The big advantage of this is that you get to assign your own error codes to the messages.

Practically all of the default Azure stuff will be coded as zero.

This means that you can assign defined ranges of code to indicate that these are for example:

Timing Messages.

Notification for information.

Notification for action.

These make analysing the logs much easier.

Btw are you aware of the WADLogs powershell trick:

“0” + [DateTime]::UtcNow.AddHours(-1).Ticks

This gives a partition key of an hour ago.

This is great for getting extracted logs.

Extract the logs into csv and use the powershell import-csv command.

This is an amazingly fast way of analysing logs.

New Home

This is a continuation of the blog at devrants.blog.com

I have been forced to move to a new host due to the appallingly service that I have been getting from blog.com. They seem to have revoked my access to the blog, but keep the content up.

I plan to migrate some of my previous articles.  I had been blogging for over 10 years.

Windows Azure Documentation Issues

Windows Azure is a great platform. There is however a massive hole where the documentation should be.

This is the list of the azure vm’s:

http://msdn.microsoft.com/en-us/library/windowsazure/ee924680.aspx

If you don’t want to use the latest guest os (if you do the upgrade plan is entirely at the mercy of the Azure OS team) then you need to stay no more than one version behind the latest. Fall off the list and then you can’t redeploy after 60 days. This is not helped by the poor quality os version details.

Here is the rss feed (http://sxp.microsoft.com/feeds/3.0/msdntn/WindowsAzureOSUpdates)

Here are some choice extracts:

 Guest OS Matrix page to be updated April 2nd
The Guest OS Matrix page has been frozen pending updates for the BUILD conference.  See this RSS feed for the latest Guest OS updates until that time.

No MSDN Guest OS Matrix updates until Jan 9th. December 2013 release info on RSS feed
No MSDN Guest OS Matrix updates until Jan 9th. Dec Guest OS release information to appear on RSS feed

Both of these are incidents where the key documentation is not updated in a timely fashion.

For example 3.12 has been released but the documentation says pending.

Theoretically 3.13 should be but is not.

Powershell Cmdlets in C# now easier to write.

These just became a lot easier with the nuget package System.Management.Automation.

When powershell first arrived you could download a small sdk that just allowed the development of cmdlets.
Over time this got folded into the windows sdk so that you had in install 6GB of files just to get the required assemblies.
Now we have a nuget package and can again write Powershell Cmdlets in C#.