0
votes

I am using Azure sdk 1.4 and am trying to set up the diagnostics on my web role. Here is what I have done in the webrole's onstart method:

            string wadConnectionString = "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString";

            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));
            RoleInstanceDiagnosticManager roleInstanceDiagnosticManager = storageAccount.CreateRoleInstanceDiagnosticManager(RoleEnvironment.DeploymentId, 
                    RoleEnvironment.CurrentRoleInstance.Role.Name, RoleEnvironment.CurrentRoleInstance.Id);
            DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();

            int loggingInterval = Int32.Parse(RoleEnvironment.GetConfigurationSettingValue("loggingInterval"));
            config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(loggingInterval);
            config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Undefined;

            roleInstanceDiagnosticManager.SetCurrentConfiguration(config);

            // For information on handling configuration changes
            // see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
            RoleEnvironment.Changing += RoleEnvironmentChanging;

Now, when I run this on the cloud emulator on my dev machine - it works fine, I can see the logs going in the WADLogs table. I have set the "Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value in my cscfg file to be "UseDevelopmentStorage=true". When I publish my webrole to the azure cloud, I set this config value to properly point to the correct storage account:

<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=acctname;AccountKey=acctKey" />

However, my webrole logs never show up on the azure cloud. When I run the cloud app on the emulator and point the diagnostics connection string to the live cloud storage, even then I am able to get the diagnostics. Can someone let me know whats going on?

Kapil

1

1 Answers

0
votes

This sounds a bit odd. I want to call out a differentiation between viewing the logs in the emulator's console (the devFabric) and having the logs stored in the storage account. If you're able to see the logs stored in the storage account when you're pointing your service to the cloud storage account but running the service locally in the local emulator, then I guess you're not waiting enough after you publish your service. The process that kicks in to push the logs from your role instance to your storage account, sometimes takes more time than the expected, I suggest to wait a little bit longer before you query the table storage