我正在使用 Windows Azure 托管我的 python 项目,我尝试启用诊断,但没有得到好的结果。
由于我使用的是 python 而不是 .NET,因此我实际配置它的唯一方法是通过配置文件。
在我的配置文件下面:
ServiceDefinition.csdef
...
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
...
ServiceConfiguration.Cloud.cscfg
....
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="DefaultEndpointsProtocol=https;AccountName=<my-account-name>;AccountKey=<my-account-key"/>
....
diagnostics.wadcfg:
<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration"
configurationChangePollInterval="PT10M"
overallQuotaInMB="1200">
<DiagnosticInfrastructureLogs bufferQuotaInMB="100"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M" />
<Logs bufferQuotaInMB="200"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M" />
<Directories bufferQuotaInMB="600"
scheduledTransferPeriod="PT5M">
<CrashDumps container="wad-crash-dumps" directoryQuotaInMB="200" />
<FailedRequestLogs container="wad-frq" directoryQuotaInMB="200" />
<IISLogs container="wad-iis" directoryQuotaInMB="200" />
</Directories>
<WindowsEventLog bufferQuotaInMB="200"
scheduledTransferLogLevelFilter="Warning"
scheduledTransferPeriod="PT5M">
<DataSource name="System!*" />
</WindowsEventLog>
</DiagnosticMonitorConfiguration>
在诊断管理器中,我实际上看不到任何数据。
谢谢。
最佳答案
请问你的diagnostics.wadcfg 位于哪里?对于常规辅助角色,diagnostics.wadcfg 必须位于根文件夹中,并且由于您的项目中没有辅助角色模块,因此角色文件夹的架构位置非常重要。确保 Python 应用程序中的文件夹结构与常规辅助角色完全相同,然后将 Diagnostics.wadcfg 放入角色根文件夹中。 (将该信息添加回您的问题以进行验证)
您是否看到在 Windows Azure Blob 存储中创建了诊断配置 XML,该存储在 *.Diagnostics.ConnectionString 中配置。这项检查表明 Azure 角色中的诊断组件能够读取提供的配置,并且可以在目标 blob 存储处创建配置 XML(相同的 Azure 存储将用于写入日志 Azure 表存储)。请核实。
最后,您的diagnostics.wadcfg 还需要一些工作。由于这是一个非 .net 辅助角色,因此您已配置 IIS 日志记录(您真的在辅助角色中运行 IIS 吗?),并且还安排系统事件日志传输“仅警告”,以便在没有警告的情况下进行传输。最后将日志传输时间设置为5分钟,这在测试中是很长的。
我可以建议如下来测试诊断是否有效:
- 如果没有运行 Azure VM 的 IIS,请删除 IIS 日志
- 将事件日志数据源从 System!* 替换为 Application!* 并将过滤器设置为 Info 级别
- 将日志传输时间更改为少于一分钟
- 在 Development Fabric 中运行完全相同的代码,并将诊断连接字符串连接到实际的 Azure 存储。
- 在您的计算机中添加自定义事件日志,并查看它们是否在时限内传输到 Azure 表存储并创建特定表
以上内容应该可以帮助您解决问题。
关于azure - 在不使用 .NET 的情况下在 Windows Azure 中启用诊断,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12316402/