本文由机器翻译。若要查看英语原文,请勾选“英语”复选框。 也可将鼠标指针移到文本上,在弹出窗口中显示英语原文。
翻译
英语

DiagnosticDataBufferConfiguration.ScheduledTransferPeriod 属性

 

获取或设置此数据缓冲区的计划传输之间的间隔,以分钟为单位。

命名空间:   Microsoft.WindowsAzure.Diagnostics
程序集:  Microsoft.WindowsAzure.Diagnostics(Microsoft.WindowsAzure.Diagnostics.dll 中)

public TimeSpan ScheduledTransferPeriod { get; set; }

属性值

Type: System.TimeSpan

类型: System.TimeSpan

返回 TimeSpan

ScheduledTransferPeriod 属性用于设置数据缓冲区将本地日志记录数据传输到持久存储的频率。 默认情况下,不会对任何数据缓冲区设置此属性,以防止意外的存储成本。

为此属性设置的值将舍入到最接近的分钟数。 因此,可以指定的最小传输周期为 1 分钟。

Example

下面的代码段在特定角色的所有实例上,将 Windows 事件日志缓冲区的传输周期远程设置为 30 分钟。

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file. // Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in // the Windows Azure Management Portal (http://manage.windowsazure.com). //string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>"; string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString; // The deployment ID and role name for your application can be obtained from the // Windows Azure Management Portal (http://manage.windowsazure.com). See your // application dashboard under Cloud Services. string deploymentID = "e2ab8b6667644666ba627bdf6f5e4daa"; string roleName = "WebRole1"; // Get the DeploymentDiagnosticManager object for your deployment. DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(connectionString, deploymentID); // Get the RoleInstanceDiagnosticManager objects for each instance of your role. IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName); // Iterate through the role instances and update the configuration. foreach (RoleInstanceDiagnosticManager roleInstance in instanceManagers) { DiagnosticMonitorConfiguration diagnosticConfiguration = roleInstance.GetCurrentConfiguration(); // Filter the logs so that only error-level logs are transferred to persistent storage. diagnosticConfiguration.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Error; // Schedule a transfer period of 30 minutes. diagnosticConfiguration.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(30.0); roleInstance.SetCurrentConfiguration(diagnosticConfiguration); }
System_CAPS_warning警告

Azure SDK 2.5 和更高版本不支持此 API。 请改用 diagnostics.wadcfg XML 配置文件。 有关详细信息,请参阅 使用 Azure 诊断收集日志记录数据

返回页首
显示: