Azure SDK,Trace.Information和WADLogsTable

时间:2015-03-12 03:09:09

标签: azure azure-sdk-.net azure-diagnostics

我正在使用Azure SDK 2.5在.NET中编写新的Cloud Service。 我知道诊断with the 2.5 SDK rekesae已经发生了一些重大变化。

我收到相互矛盾的信息是我是否仍然可以使用Azure诊断程序将Azure。*输出中的Trace。*输出捕获到WADLogsTable

我知道我可以使用ETW作为替代方案,但现在我正在要求它。

根据this文章,我仍然可以使用Trace来使用Azure诊断1.3捕获我的日志 - 据我所知,SDK 2.5附带了这些日志。

不幸的是我无法让它发挥作用。

我的worker角色的app.config如下所示:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
    <trace>
        <listeners>
            <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                name="AzureDiagnostics">
                <filter type="" />
            </add>
        </listeners>
    </trace>
</system.diagnostics>
</configuration>

在我的worker角色的代码中,我有跟踪代码,如下所示:

Trace.TraceInformation("Something happened");

我的公共diagnostics.wadcfg文件如下所示:

<?xml version="1.0" encoding="utf-8"?>
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
  <DiagnosticMonitorConfiguration overallQuotaInMB="4096">
    <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Information" />
  </DiagnosticMonitorConfiguration>
</WadCfg>
<StorageAccount>mystorageAccount</StorageAccount>
</PublicConfig>

我已使用此文件使用PowerShell命令配置诊断服务扩展:

Set-AzureServiceDiagnosticsExtension

永远不会创建WADLogsTable。 如果我启用其他诊断服务(如Perf Counter),则会创建并填充相关表(WADPerformanceCountersTable)。

我正在使用:

  • Visual Studio 2012
  • .NET 4.5.1
  • Azure Powershell(来自Web平台安装程序的最新版本)
  • Azure SDK 2.5

有人能把我从痛苦中解救出来吗? 非常感谢

1 个答案:

答案 0 :(得分:0)

我刚刚创建了一个生成跟踪日志的默认辅助角色,我注意到了公共配置中的一个区别

<?xml version="1.0" encoding="utf-8"?>
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
  <DiagnosticMonitorConfiguration overallQuotaInMB="4096">
    <WindowsEventLog scheduledTransferPeriod="PT1M">
      <DataSource name="Application!*" />
    </WindowsEventLog>
    <Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Information" />
  </DiagnosticMonitorConfiguration>
</WadCfg>
<StorageAccount>mystorageAccount</StorageAccount>
</PublicConfig>
相关问题