Exportar (0) Imprimir
Expandir Tudo

Enumeração LogLevel

[Este tópico é uma documentação de pré-lançamento e está sujeito a alterações em versões futuras. Os tópicos em branco são incluídos como espaços reservados.]

Enumeration of a standard set of logging levels.

Namespace: Microsoft.WindowsAzure.Diagnostics
Assembly: Microsoft.WindowsAzure.Diagnostics (em microsoft.windowsazure.diagnostics.dll)

'Uso
Dim instance As LogLevel

public enum LogLevel
public enum LogLevel
public enum LogLevel

Nome do membroDescrição
CriticalIndicates logs for a critical alert.
ErrorIndicates logs for an error.
InformationIndicates logs for an informational message.
UndefinedIndicates logs at all levels.
VerboseIndicates logs at all levels.
WarningIndicates logs for a warning.

The LogLevel enumeration is used to specify a logging level for the ScheduledTransferLogLevelFilter property of a log data buffer. When you specify a LogLevel, all events greater than and equal to the specified severity are transferred to persistent storage. For example, if you specify LogLevel = Warning, Error and Critical logs will also be transferred to persistent storage.

When this property is set to Undefined, no filter is applied and all logging events at all levels are transferred.

Example

The following code snippet will transfer only error-level Windows Event logs from local storage to persistent storage every minute.

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 1 minute.
    diagnosticConfiguration.WindowsEventLog.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);

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

    return base.OnStart();
}


Plataformas de desenvolvimento

Windows XP Professional com Service Pack 2 (SP2)

Plataformas de destino

Contribuições da comunidade

Mostrar:
© 2015 Microsoft