Application Logging Services
The mmApplicationLog class allows you to log application information such as exceptions and trace/debug information. This object works for Windows and Web applications.
Note: Although event logs are stored on the local machine by default, you can specify that logs are stored on a different machine on the network, such as a common server. See the setting for "machine" in the "Application Log Configuration Settings" section below.
Referencing the Application Log Object
To reference this object from anywhere in your application, use the static Log property of the mmAppBase class.For example, in C#:
// Use namespace at the top of your source code file using OakLeaf.MM.Main;
mmAppBase.Log.WriteTrace("Trace information");
And in VB .NET:
'' Import namespace at the top of your source code file Imports OakLeaf.MM.Main
mmAppBase.Log.WriteTrace("Trace information")
Application Log Configuration Settings
The following settings stored in the app.config and web.config file are used to specify log settings:
<!-- Event Log, Trace Log and Transaction Log settings: 1. The EventLog Level setting (options are "Error", "Warning", "Info", and "Verbose" 2. The name of the machine on which the event log resides, default is "." (local machine) 3. The name of the log --> <add key="EventLog\Level" value="Verbose" /> <add key="EventLog\Machine" value="." /> <add key="EventLog\Name" value="Application" /> <add key="TraceLog\Machine" value="." /> <add key="TraceLog\Name" value="Application" /> <add key="TransactionLog\Machine" value="." /> <add key="TransactionLog\Name" value="Application" />
- Level applies only to the Event Log. It specifies the level of information written to the log. This setting corresponds to the .NET Framework's TraceLevel enumeration:
Member Name Value Description Off 0 No logging Error 1 Log exceptions Warning 2 Log exceptions and warnings Info 3 Log exceptions, warnings, and informational messages Verbose 4 Log exceptions, warnings, informational messages, debugging messages and tracing messages - Machine specifies the name of the computer to read and write the log. By default, the log is stored on the local computer ("."), but you can specify a different machine. For example:
<add key="EventLog\Machine" value="MyServer" />
Name specifies the name of the log ("Application" by default)
Application Log Members
Here is a description of the main methods of mmApplication Log (C# code is shown first and VB .NET second):- WriteException - Logs the specified exception to the event log if the EventLog\Level configuration setting is set to Error, Warning, Info, or Verbose. This method retrieves the message, source, target site, and stack trace information from the exception object, formats it into a single string and writes it to the application event log.
public virtual void WriteException(Exception e)
Public Overridable Sub WriteException(e As Exception)
- WriteWarning - Logs the specified warning to the event log if the EventLog\Level configuration setting is set to Warning, Info, or Verbose.
public virtual void WriteWarning(string warning)
Public Overridable Sub WriteWarning(warning As String)
- WriteInfo - Logs the specified information to the event log if the EventLog\Level configuration setting is set to Info or Verbose.
public virtual void WriteInfo(string info)
Public Overridable Sub WriteInfo(info As String)
- WriteTrace - Logs the specified trace string to the trace log.
public virtual void WriteTrace(string trace)
Public Overridable Sub WriteTrace(trace As String)
- WriteTransaction - Logs the specified transaction string in the transaction log.
public virtual void WriteTransaction(string transaction)
Public Overridable Sub WriteTransaction(transaction As String)
Viewing Event Logs
You can view Event Logs from within Visual Studio's Server Explorer, but you get many more options by using the Windows Event Viewer instead. You can launch the Event Viewer from the Control Panel's Administrative Tools.When you first launch the Event Viewer it displays log files on your local computer:

From the Action menu you can choose to view log files on another computer. By default, MM .NET writes log entries to the Application log. If you click on Application in the left pane, it lists all the entries for that log:

From the View menu you can add/remove columns, set a filter, perform a Find, or create your own customized view.
To see more information about a particular error, you can double-click it or right-click it and select Properties from the shortcut menu. This launches the Event Properties dialog:

You can use the up and down arrows to navigate to the previous/next log entries.
© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 05/01/18
Comment or report problem with topic
