gpt4 book ai didi

Azure SDK、Trace.Information 和 WADLogsTable

转载 作者:行者123 更新时间:2023-12-04 21:13:48 25 4
gpt4 key购买 nike

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

我得到的冲突信息是我是否仍然可以使用 Azure 诊断来捕获 Trace.* 输出到 Azure 表存储中的 WADLogsTable

我知道我可以使用 ETW 作为替代方案,但这就是我现在所要求的。

根据this文章我仍然可以使用 Trace 通过 Azure Diagnostics 1.3 捕获我的日志 - 据我所知,它已随 SDK 2.5 一起提供。

不幸的是我无法让它工作。

我的辅助角色的 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>

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

Trace.TraceInformation("Something happened");

我的公共(public)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

谁能帮我摆脱痛苦?非常感谢

最佳答案

您的部署情况如何?在相同的设置(VS2012、Azure 2.5 SDK)中,我只看到使用 Visual Studio“发布”向导创建了 WADLogsTable,该向导显然为您配置了诊断扩展。请参阅:

https://msdn.microsoft.com/en-us/library/azure/dn873976.aspx

Diagnostics configuration must be applied separately after deployment - Because Azure SDK version 2.5 uses the extension model, the diagnostics extension and configuration are no longer part of the deployment package and must be applied separately after the deployment. Visual Studio will apply the extension and configuration for you when you use the Publish wizard to deploy your application [...]

我无法让 PowerShell cmdlet 工作(老实说,我并没有为此付出太多努力),但作为一种解决方法,当我使用 VS“发布”向导进行部署时,创建了 WADLogsTable,我可以看到我的日志流动。当我通过 Azure 门户打包并上传时,没有发生这种情况。

在可预见的 future 可能会是这样;这种情况在 2.6 SDK 中似乎没有改变(尽管他们在 2.5 中修复了许多令人厌烦的诊断问题):https://msdn.microsoft.com/en-us/library/azure/dn186185.aspx

关于Azure SDK、Trace.Information 和 WADLogsTable,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29001243/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com