Disable error log

Posted by Community Admin on 04-Aug-2018 14:26

Disable error log

All Replies

Posted by Community Admin on 25-Oct-2012 00:00

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.

Posted by Community Admin on 30-Oct-2012 00:00

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 www.sitefinity.com/.../custom-error-loggin-solution-help

       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");
 
           
       

This thread is closed