Uplift contains a helper class and configuration too for writing log entries to a SQL table. This method produces a higher performance log that is also queryable.

LogWriter Class

LogWriter is a static class with two overloads for writeEntry.

The most common approach is to use

public static void writeEntry(string log, string _event, string caller, LogType type, string message, params object[] args)

This allows simple single line authoring of log entries.


  • log – Name of log to write to. This must match the name specified in the configuration.
  • _event – String name of event being logged (max length 50 characters)
  • caller – Name of system that is writing the log entry (max length 50 characters)
  • type – Info, Alert, or Error
  • message – Message to log, may include format string symbols (e.g. "{0}", "{1:0.00}")
  • args – Optional params object[] to use to format the message (uses String.Format)
public static void writeEntry(LogEntry entry)

Similar to previous writeEntry method, but takes a LogEntry object. This is useful when a log entry must be constructed and saved for later use.

Log Configuration

In order for Log entries to be written, the configuration for where to write the data must be provided in the Uplift App.config. For instructions on how to create and reference this file, refer to Config.

Example Configuration

<?xml version="1.0" encoding="utf-8" ?>
      <add name="FIM"
           connectionString="Server=localhost;Database=FIMSupport;Integrated Security=True" />

Configuration Overview

The LogWriter is configured using a custom Configuration class (LogConfig). StudioIDM.Uplift.LogConfig must be registered in <configSections> of the App.config file. All desired logs may be enumerated in the <Logging> section, under the element <Logs>.

Each entry requires a name which will be used to reference that log, the name of the table to write to, and a valid connectionString to the database. It is not necessary to create the table. As long as LogWriter can make a connection to the database it will create the table the first time it needs to write a log entry.

Copyright © SoftwareIDM