After getting past my confusion with how to set-up diagnostics for a web sited deployed in Azure, it was actually very easy to get NLog to route all messages to the Azure diagnostics table - WADLogsTable.
Firstly you need to configure the Azure role for diagnostics, there seems to be 2 ways to do this either in-code via the OnStart() method or using a config file. Obviously the use of a config file is the preferred way when dealing with large scale deployments (by a separate IT department).
Code:
Configuration (diagnostics.wadcfg):
Secondly, you need to configure NLog, all this involves is including the trace target and defining the rule to write to the trace target:
And finally browse the contents of the WADLogsTable once you've deployed to the cloud and waited the required time for the logs to be shipped. I'm using the Windows Azure Platform Management Tool (MMC) available here:
I still stand by my assertion that getting diagnostics working in Azure is less than satisfactory.
Comments
Post a Comment