C# Class Ms.Azure.Logging.Helpers.LoggingHelper

Helper class to initialize logging for Azure webroles, workerroles and webapplications
This class is meant to make it as easy as possible to enable logging, using just a few statements. Some defaults are chosen that might not fit all situations, such as a TransferInterval on the TableStorageAppender of 5 minutes.
Afficher le fichier Open project: martijns/Ms.Azure.Logging

Méthodes publiques

Méthode Description
ClearAllLoggers ( ) : void

Clear all existing appenders and loggers

FlushAppenders ( ) : void

Flush any appenders that we know to support flushing. Typically used to flush the TableStorageAppender just before the application shuts down.

InitializeAzureTableLogging ( CloudStorageAccount storageAccount, string customTable = null, log4net.Core.Level logLevel = null ) : void

Initializes log4net with azure table logging.

InitializeAzureTableLogging ( StorageCredentials credentials, string customTable = null, log4net.Core.Level logLevel = null ) : void

Initializes log4net with azure table logging.

InitializeFileLogging ( string logfile, log4net.Core.Level logLevel = null ) : void

Initializes log4net with file logging.

InitializeFromConfiguration ( NameValueCollection config ) : void

Initializes logging from configuration. The NameValueCollection will read the following properties: - LogType: TableStorage or File - LogStorageName: account name for the storage account - LogStorageKey: key for the storage account - LogStorageTable: optional, customize the table to log to - LogFile: Filename to log to - LogStorageString: use a connection string to indicate storage account and credentials (makes LogStorageName and LogStorageKey obsolete and has preference)

Private Methods

Méthode Description
DetermineLevel ( string level ) : log4net.Core.Level

Converts a string loglevel to the correct type in order to configure an appender

Things would be so much easier and flexible if they would've made it an Enum or some collection

Method Details

ClearAllLoggers() public static méthode

Clear all existing appenders and loggers
public static ClearAllLoggers ( ) : void
Résultat void

FlushAppenders() public static méthode

Flush any appenders that we know to support flushing. Typically used to flush the TableStorageAppender just before the application shuts down.
public static FlushAppenders ( ) : void
Résultat void

InitializeAzureTableLogging() public static méthode

Initializes log4net with azure table logging.
public static InitializeAzureTableLogging ( CloudStorageAccount storageAccount, string customTable = null, log4net.Core.Level logLevel = null ) : void
storageAccount CloudStorageAccount
customTable string
logLevel log4net.Core.Level
Résultat void

InitializeAzureTableLogging() public static méthode

Initializes log4net with azure table logging.
public static InitializeAzureTableLogging ( StorageCredentials credentials, string customTable = null, log4net.Core.Level logLevel = null ) : void
credentials StorageCredentials
customTable string
logLevel log4net.Core.Level
Résultat void

InitializeFileLogging() public static méthode

Initializes log4net with file logging.
public static InitializeFileLogging ( string logfile, log4net.Core.Level logLevel = null ) : void
logfile string
logLevel log4net.Core.Level
Résultat void

InitializeFromConfiguration() public static méthode

Initializes logging from configuration. The NameValueCollection will read the following properties: - LogType: TableStorage or File - LogStorageName: account name for the storage account - LogStorageKey: key for the storage account - LogStorageTable: optional, customize the table to log to - LogFile: Filename to log to - LogStorageString: use a connection string to indicate storage account and credentials (makes LogStorageName and LogStorageKey obsolete and has preference)
public static InitializeFromConfiguration ( NameValueCollection config ) : void
config System.Collections.Specialized.NameValueCollection
Résultat void