Windows azure 诊断无法在云上运行

发布于 2024-12-14 05:35:23 字数 1795 浏览 0 评论 0原文

我正在使用 Azure sdk 1.4,并尝试在我的 Web 角色上设置诊断。以下是我在 webrole 的 onstart 方法中所做的操作:

            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;

现在,当我在我的开发计算机上的云模拟器上运行它时 - 它工作正常,我可以看到 WADLogs 表中的日志。我已将 cscfg 文件中的“Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString”值设置为“UseDevelopmentStorage=true”。当我将 webrole 发布到 azure 云时,我设置此配置值以正确指向正确的存储帐户:

但是,我的网络角色日志从未显示在蔚蓝云上。当我在模拟器上运行云应用程序并将诊断连接字符串指向实时云存储时,即使这样我也能够获取诊断信息。有人可以让我知道发生了什么事吗?

卡皮尔

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寻梦旅人 2024-12-21 05:35:23

这听起来有点奇怪。我想指出在模拟器控制台(devFabric)中查看日志和将日志存储在存储帐户中之间的区别。
如果当您将服务指向云存储帐户但在本地模拟器中本地运行该服务时,您能够看到存储帐户中存储的日志,那么我猜您在发布服务后等待的时间还不够。将日志从角色实例推送到存储帐户的过程有时会比预期花费更多时间,我建议在查询表存储之前等待一段时间

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文