如何查看azure诊断日志

Pav*_*van 7 azure azure-storage azure-table-storage

我无法找到如何查看azure诊断日志.我写的代码如下.

DiagnosticMonitorConfiguration config = iagnosticMonitor.GetDefaultInitialConfiguration();
System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information;
config.WindowsEventLog.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
Run Code Online (Sandbox Code Playgroud)

然后我Trace.WriteLine("some message");在代码中添加了.现在我在哪里可以找到这些消息.我检查了Visual Studio服务器资源管理器,在那里我添加了我的存储帐户参考.wad-control-container只有配置文件.

San*_*tia 9

您可能想看看Michael S. Collier撰写的这篇博客文章.云项目中的设置可能会导致日志最终出现在您预期的其他位置:

http://michaelcollier.wordpress.com/2012/04/02/where-is-my-windows-azure-diagnostics-data/

更新:

请注意,您必须处理每一个小细节,以使一切正常.

你在哪里写作Trace.WriteLine("some message");?它在你的WebRole.cs中吗?如果是这种情况,您将需要为WebRole.cs配置跟踪侦听器(这在其他进程中运行,与您的实际Web应用程序不同).

下面是一个如何在WebRole.cs类中设置跟踪侦听器的示例:

System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
System.Diagnostics.Trace.AutoFlush = true;
Run Code Online (Sandbox Code Playgroud)

设置完成后,可以使用Trace.WriteLine.