我们在 azure 应用程序中广泛使用跟踪日志记录,但有时我们会在日志中看到长达 90m 左右的间隙。
为什么会这样,我该如何进行诊断?这一点非常重要,因为我们使用 WADLogsTable 中的数据作为警报系统的源数据。
更新:抱歉耽搁了。我的配置如下:
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
其余的配置以编程方式完成:
公共静态无效ConfigureDiagnosticMonitor(TimeSpan?scheduledTransferPeriod){TimeSpan stp = scheduleTransferPeriod??DefaultScheduledTransferPeriod;
var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
config.OverallQuotaInMB = 8192;
// configure Windows Event Log monitoring.
config.WindowsEventLog.DataSources.Add("Application!*");
config.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Warning;
config.WindowsEventLog.ScheduledTransferPeriod = stp;
// configure Diagnostic infrastructure logs
config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Information;
config.DiagnosticInfrastructureLogs.BufferQuotaInMB = 100;
config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = stp;
// configure Logs
config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
config.Logs.BufferQuotaInMB = 100;
config.Logs.ScheduledTransferPeriod = stp;
// configure Directories
config.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
config.Directories.ScheduledTransferPeriod = stp;
DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
}