Click or drag to resize

ErrorModuleLogger Property

Gets the ErrorLogger object used by the ErrorModule object for logging exceptions.

Namespace: GSF.ErrorManagement
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.181-beta
Syntax
public static ErrorLogger Logger { get; }
View Source

Property Value

ErrorLogger
Remarks
Logger property can be used for logging handled exception throughout the web application.
Example
This example shows the use of Logger for logging handled exception:
C#
using System;
using GSF.ErrorManagement;

namespace WebApp
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string s = null;
                s.ToCharArray();            // This will result in NullReferenceException.
            }
            catch (Exception ex)
            {
                ErrorModule.Logger.Log(ex); // Log the encountered exception.
            }
        }
    }
}
See Also