2012-06-23 68 views
4

將我的azure項目升級到SDK 1.7版後,日誌已停止傳輸到存儲。我一直在看這幾個小時,看不出有什麼變化(差異也沒有幫助)。1.7 SDK中的Azure日誌記錄

我想我需要一組新鮮眼睛來幫助定位問題。你看到這裏有什麼不對嗎? 1.7SDK中的設置是否改變?

的Web.config

<system.diagnostics xdt:Transform="Insert"> 
    <trace> 
     <listeners> 
     <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics"> 
      <filter type="" /> 
     </add> 
     </listeners> 
    </trace> 
    </system.diagnostics> 

服務定義

<Imports> 
    <Import moduleName="Diagnostics" /> 
</Imports> 

CloudConfig

<ConfigurationSettings> 
     <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" 
       value="DefaultEndpointsProtocol=https;AccountName=[account];AccountKey=[key]" /> 
</ConfigurationSettings> 

的OnStart

var config = DiagnosticMonitor.GetDefaultInitialConfiguration(); 

//event log 
config.WindowsEventLog.DataSources.Add("System!*"); 
config.WindowsEventLog.DataSources.Add("Application!*"); 
config.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(5); 
config.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Warning; 


config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(5); 
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information; 
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config); 

return base.OnStart(); 

回答

8

的問題是與你的web.config,你需要更新組件的版本1.7.0.0:

Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener,Microsoft.WindowsAzure.Diagnostics,版本= 1.7.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35

+0

謝謝,我知道我必須丟失一些明顯的信息 – Joe

+0

請記住,如果您的部署中有WCF服務,則還應該更改WAIISHost.exe.config。如果您升級部署,此配置將不會升級! – 321X

+0

非常感謝。我也有這個問題,這讓我瘋狂。我從來沒有想到過自己。如果我可以多次鼓勵你,我會! – Dogmang

0

您需要關注@Sandrino建議,同時我也會看到一些代碼問題。您還沒有使用SetCurrentConfiguration()和GetDefaultInitialConfiguration()來最終保存傳輸時間和日誌級別。您必須使用set下面這些API的:

GetDefaultInitialConfiguration() 
SetCurrentConfiguration() 

OR

GetCurrentConfiguration() 
SetCurrentConfiguration() 

這可能導致problem,如果你開始收集在你的應用程序跟蹤消息,以便其更好地有這樣的代碼完全..

+0

是不是我的'DiagnosticMonitor.Start(「...」,配置);'採取和設置它?它似乎現在工作。 – Joe