Class LogManager

The LogManager provides the top level access to the log and is the public facing interface to the log. It uses an underlying ILogProvider implementation to write to the appropriate log store. which includes Sql Server, Text File, Xml File or EventLog (and can be extended with your own providers)

To use you'll need to create an instance of the LogProvider once can call the static Create method. From then on in you can always use the LogManager.Current instance to access features of the logging engine.

To set up (Application_Start // Specify Sql Log with a Connection string or ConnectionString Config Entry Name LogManager.Create( new SqlLogAdapter("WestWindAdmin") );

To access log features: LogEntry entry = new LogEntry(); entry.Message = "Application started..."; entry.ErrorLevel =

public class LogManager : object

Class Members



Main signature allows creating of manager with an adapter to specify logging target

Available Adapters are: SqlLogAdapter XmlLogAdapter (n/a) TextLogAdapter (n/a) EventLogAdapter (n/a)


Clears out all the entries in the log

public bool Clear()

public bool Clear(int countToLeave)


Creates an instance of a log Manager and attaches it to the static Current property that is reusable throughout the application.

This method should be called once when the application starts

public static LogManager Create(ILogAdapter adapter)

public static LogManager Create(LogAdapterTypes logType)

public static LogManager Create()


Creates a new Log table/file/log depending on the provider. Check provider documentation on requirements for 'connections' or locations for logs.

public bool CreateLog()


Deletes the Log completely by removing the table/file/log

public bool DeleteLog()


public IEnumerable GetEntries(ErrorLevels errorLevel,     int count,     DateTime? dateFrom,     DateTime? dateTo,     string fieldList)


Returns count of all entries for a given error level.

public int GetEntryCount(ErrorLevels errorLevel)


Retrieves an individual log entry if possible. Depending on the implementation of the log log entries may not be retrievable individually (for example from a text log) or the event log.

public WebLogEntry GetWebLogEntry(int id)


Writes a Web specific log entry into the log

public bool Log(WebLogEntry entry,     bool logHttpInfo)


Writes an Error message entry to the log

public bool LogError(string message,     string details,     string stackTrace)

public bool LogError(Exception ex,     bool logHttpInfo)


Writes an Info entry into the log

public bool LogInfo(string message,     string details,     string stackTrace,     bool logHttpInfo)


Writes a warning message to the log

public bool LogWarning(string message,     string details,     string stackTrace,     bool logHttpInfo)


Writes a Web specific log entry into the log

public bool WriteEntry(WebLogEntry entry)


Static instance of the log manager. Used so you can configure the log manager once and easily reuse it in an application


Global instance of the LogAdapter used


Namespace: Westwind.Utilities.Logging
Assembly: westwind.utilities.dll

© West Wind Technologies, 2019 • Updated: 06/23/19
Comment or report problem with topic