Azure:如何创建WADLogsTable以捕获诊断代码?

myt*_*nts 9 diagnostics azure azure-storage azure-table-storage

在将相应的连接字符串添加到ServiceConfiguration.cscfg和以下代码之后,我有一个工作者角色,我想获得诊断反馈...

//DiagnosticMonitor.Start("DiagnosticsConnectionString");
DiagnosticMonitorConfiguration diagConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagConfig.WindowsEventLog.DataSources.Add("Application!*");
diagConfig.WindowsEventLog.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(5.0);
diagConfig.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(5.0);

Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitor.Start("DiagnosticsConnectionString", diagConfig);
CrashDumps.EnableCollection(true);
Run Code Online (Sandbox Code Playgroud)

当我调用"System.Diagnostics.Trace.TraceInformation("测试日志")时,我希望能够在目标Azure存储帐户的WADLogsTable中找到记录.但是,该表不存在 - 它是如何创建的?我读过的所有文档都没有涵盖这一点.
提前感谢,

Dav*_*gon 6

您需要设置日志级别过滤器,例如:

diagConfig.Logs.ScheduledTransferLogLevelFilter = LogLevel.Information;
Run Code Online (Sandbox Code Playgroud)

在这里有一个更详细的答案.

请注意,偶尔在模拟环境中,不会立即创建表.