DotNetNuke and Error Logging

Mike Flynn picture Mike Flynn · Jan 10, 2012 · Viewed 15.1k times · Source

Does DotNetNuke provide any built in Error Logging framework? My client is using DotNetNuke and I don't see a global error logging framework. I see the class below with some try/catch's using them.

namespace DotNetNuke.Services.Exceptions
{
    [StandardModule]
    public sealed class Exceptions
    {
        public static ExceptionInfo GetExceptionInfo(Exception e);
        public static void LogException(Exception exc);
        public static void LogException(ModuleLoadException exc);
        public static void LogException(PageLoadException exc);
        public static void LogException(SchedulerException exc);
        public static void LogException(SecurityException exc);
        public static void LogSearchException(SearchException exc);
        public static void ProcessModuleLoadException(Control ctrl, Exception exc);
        public static void ProcessModuleLoadException(PortalModuleBase objPortalModuleBase, Exception exc);
        public static void ProcessModuleLoadException(Control ctrl, Exception exc, bool DisplayErrorMessage);
        public static void ProcessModuleLoadException(PortalModuleBase objPortalModuleBase, Exception exc, bool DisplayErrorMessage);
        public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc);
        public static void ProcessModuleLoadException(string FriendlyMessage, Control ctrl, Exception exc, bool DisplayErrorMessage);
        public static void ProcessModuleLoadException(string FriendlyMessage, PortalModuleBase objPortalModuleBase, Exception exc, bool DisplayErrorMessage);
        public static void ProcessPageLoadException(Exception exc);
        public static void ProcessPageLoadException(Exception exc, string URL);
        public static void ProcessSchedulerException(Exception exc);
    }
}

Answer

Chris Hammond picture Chris Hammond · Jan 11, 2012

Log4Net is available, but most modules use the custom exceptions class within DNN which will store "events" in the EventLog table, you can access the reports for "events" including errors, from the Admin/Event Viewer page.

Typically within a module you would do something like the following.

try
{
    //STUFF HERE
}
catch (Exception exc) //Module failed to load
{
    Exceptions.ProcessModuleLoadException(this, exc);
}