1

我想在Windows Azure診斷中使用跟蹤偵聽器來記錄某些消息。我能夠看到診斷程序在永久存儲上創建的blob,但我無法看到跟蹤偵聽器的輸出。Windows Azure:無法在診斷日誌中看到跟蹤偵聽器的輸出

這是我在輔助角色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"); 
+0

幾天前我回答了一個類似的問題:http://stackoverflow.com/questions/15672003/how-to-log-messages-to-the-windows-azure-storage/15673515#15673515。 HTH。 –

回答

0

它看起來像你缺少你的日誌緩衝區。如果沒有緩衝區可供讀取,則不會傳輸任何內容。嘗試添加類似:

config.OverallQuotaInMB = 4096; 
config.Logs.BufferQuotaInMB = 512; 

你的角色的診斷BLOB(中發現的WAD控制容器)的含量應該是這個樣子

<?xml version="1.0"?> 
<ConfigRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
    <DataSources> 
     <OverallQuotaInMB>4096</OverallQuotaInMB> 
     <Logs> 
      <BufferQuotaInMB>512</BufferQuotaInMB> 
      <ScheduledTransferPeriodInMinutes>1</ScheduledTransferPeriodInMinutes> 
      <ScheduledTransferLogLevelFilter>Information</ScheduledTransferLogLevelFilter> 
     </Logs> 
     ....