我想在windows azure诊断中使用跟踪侦听器记录一些消息 . 我能够看到诊断在我的永久存储器上创建的blob,但我看不到跟踪侦听器的输出 .
这是我在worker角色onStart方法中的尝试:
var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0);
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
System.Diagnostics.Trace.AutoFlush = true;
System.Diagnostics.Trace.Write("some logging");
2 回答
看起来你在日志上缺少缓冲区 . 如果没有要读取的缓冲区,则无法传输任何内容 . 尝试添加以下内容:
您的角色的诊断blob(在wad-control-container中找到)内容应该类似于
我写了一篇博客文章,专门用于在Workerroles中启用跟踪 . 你在这里找到它:http://blog.amtopm.be/2014/07/20/azure-diagnostics-how-to-troubleshoot-your-code/
如果您还有问题,请告诉我 .