LogLevel Enumeration
Assembly: Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)
| Member name | Description |
|---|---|
| Critical | Value: 1. Indicates logs for a critical alert. |
| Error | Value: 2. Indicates logs for an error. |
| Information | Value: 4. Indicates logs for an informational message. |
| Undefined | Value: 0. Indicates logs at all levels. |
| Verbose | Value: 5. Indicates logs at all levels. |
| Warning | Value: 3. Indicates 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();
}
Development Platforms
Windows Vista, Windows 7 and Windows Server 2008Target Platforms
Yes, the documentation is not clear. You can look in the source code for the Azure Management Tools (available on codeplex) though and see the enumeration.
Undefined = 0
Critical = 1
Error = 2
Warning = 3
Information = 4
Verbose = 5
- 1/20/2012
- rickrain