导出 (0) 打印
全部展开

DiagnosticMonitorConfiguration.WindowsEventLog 属性

Gets or sets the buffer configuration for Windows event logs.

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

用法
Dim instance As DiagnosticMonitorConfiguration
Dim value As WindowsEventLogsBufferConfiguration

value = instance.WindowsEventLog

instance.WindowsEventLog = value

public WindowsEventLogsBufferConfiguration WindowsEventLog { get; set; }
/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public WindowsEventLogsBufferConfiguration get_WindowsEventLog ()

/** @property */
/** @attribute CompilerGeneratedAttribute() */ 
public void set_WindowsEventLog (WindowsEventLogsBufferConfiguration value)

CompilerGeneratedAttribute 
public function get WindowsEventLog () : WindowsEventLogsBufferConfiguration

CompilerGeneratedAttribute 
public function set WindowsEventLog (value : WindowsEventLogsBufferConfiguration)

属性值

Returns WindowsEventLogsBufferConfiguration.

The WindowsEventLog property is used to specify the WindowsEventLogsBufferConfiguration data buffer that is used for logging Windows events. This property enables you to add event log sources to the DataSources collection for each event type you want to capture. You can also specify the ScheduledTransferLogLevelFilterLogLevel enumeration for setting the severity level of each log to transfer to persistent storage, and the default data buffer properties: DiagnosticDataBufferConfiguration and ScheduledTransferPeriod.

Example

The following code snippet creates a new diagnostic monitor configuration, specifies the configuration for Windows events, then starts the diagnostic monitor using the new configuration.

public override bool OnStart()
{
    // Get the default initial configuration for DiagnosticMonitor.
    DiagnosticMonitorConfiguration diagnosticConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();

    // Add Application logs to the configuration.
    diagnosticConfiguration.WindowsEventLog.DataSources.Add("Application!*");

    // 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);

    // Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
    DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", diagnosticConfiguration);

    return base.OnStart();
}


此类型的任何公共静态(在 Visual Basic 中为 Shared)成员都是线程安全的。但不保证所有实例成员都是线程安全的。

开发平台

Windows XP Home Edition, Windows XP Professional, Windows Server 2003、Windows Server 2008 和 Windows 2000

目标平台

社区附加资源

Microsoft 正在进行一项网上调查,以了解您对 MSDN 网站的意见。 如果您选择参加,我们将会在您离开 MSDN 网站时向您显示该网上调查。

是否要参加?
显示:
© 2014 Microsoft