More in this section

Forums / Developing with Sitefinity / Disable error log

Disable error log

2 posts, 0 answered
  1. Jeff
    Jeff avatar
    3 posts
    Registered:
    19 Jun 2011
    25 Oct 2012
    Link to this post
    Is there a way to disable the error log? I have seen tutorials for how to change the location of the log, but we would like to just disable it from being created since we have alternative logging.
  2. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    30 Oct 2012
    Link to this post
    Hello Jeff!  I just did this actually and it is rather simple.  In your Global.asax (you may have to add one to your Sitefinity project) add the following lines of code.  Like you I saw the posts to change the location of the log but I figured out a way to modify it.  I also posted the full solution I created using log4net in this post http://www.sitefinity.com/devnet/forums/developing-with-sitefinity-/custom-error-loggin-solution-help#TbFalPpGJ0WRK_m8cKlT0g

           protected void Application_Start(object sender, EventArgs e)
           {
                //Setup method to remove Sitefinity Error Logging
               ObjectFactory.Initialized += SetupSitefinityLogPath;
           }
     
           protected void SetupSitefinityLogPath(object s, ExecutedEventArgs args)
           {
     
               if (args.CommandName == "ConfigureLogging")
               {
     
                   var builder = args.Data as ConfigurationSourceBuilder;
     
                   var errorLog = ((Telerik.Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings)builder.Get("loggingConfiguration")).TraceListeners.SingleOrDefault(l => l.Name == "ErrorLog") as Telerik.Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData;
     
                   //Remove the error logging trace listeners so that the Sitefinity error logs are not created.
                   ((Telerik.Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings)builder.Get("loggingConfiguration")).TraceListeners.Remove("ErrorLog");
                   ((Telerik.Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings)builder.Get("loggingConfiguration")).TraceSources.Remove("ErrorLog");
     
               }
           }
2 posts, 0 answered