Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DotNetNuke and Error Logging

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);
    }
}
like image 701
Mike Flynn Avatar asked Jan 10 '12 22:01

Mike Flynn


3 Answers

My understanding is that you have the following options:

  • use class Exceptions for logging errors
  • for logging in files use DnnLogger or LoggerSource. See How should LoggerSource be used in DNN 7+?
  • for logging in Admin Event Viewer (this actually uses a sql table) use EventLogController. See Print to DotNetNuke Event Log/Viewer
like image 144
Valentin Avatar answered Sep 27 '22 20:09

Valentin


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);
}
like image 33
Chris Hammond Avatar answered Sep 27 '22 18:09

Chris Hammond


DNN includes log4net, see this wiki article: http://dnnsoftware.com/Wiki/Page/log4net-In-DotNetNuke

like image 29
demo.b Avatar answered Sep 27 '22 18:09

demo.b