I’ve been using Windows Azure to host a Worker Role in a Cloud Service for an in-development version of my new app, Steam Community Viewer. This service will allow users to be notified of when their friends come online or start playing a game through Windows 8 Toast Notifications. Additionally, it will push updates to Live Tiles for new Steam deals.
During my tests, I tried to turn diagnostics on, but failed to save them to a permanent storage because the table that gets created when you enable basic logging wasn’t actually being created! Windows Azure Basic Logs will be saved in Azure Storage Tables under “WADLogsTable” based on a logging level (error, critical, verbose, etc…). This table is supposed to be automatically created when the service is uploaded and deployed with tracing enabled. If you find that the official Windows Azure documentation on using diagnostics is not helping you with this task, try the code below in your service OnStart() overload.
// instantiate and add a new diagnostic monitor trace listener
// before doing this, you should make sure no listeners are defined in your web.config or app.config
var tempListener = new DiagnosticMonitorTraceListener();
// creates a diagnostic manager instance based on an azure storage account
// before doing this, setup a storage account using the azure web portal
string connectionStringName = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";
var storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(connectionStringName));
var roleInstanceDiagnosticManager = storageAccount.CreateRoleInstanceDiagnosticManager(RoleEnvironment.DeploymentId,
// setup the basic logging configuration options
// ScheduledTransferPeriod is how often the trace log is copied to the storage account tables
// ScheduledTransferLogLevelFilter is the filter on the messages to copy
// BufferQuotaInMB is how much space is available to the local buffer (when limit is reached, old data is purged)
var config = roleInstanceDiagnosticManager.