External Logging Sample

Posted by Community Admin on 05-Aug-2018 15:41

External Logging Sample

All Replies

Posted by Community Admin on 06-Aug-2014 00:00

I have a question on the External Logging sample (to raygun)

 I don't want another project attached to my SF WebApp so I copied the code over to our existing assembly.

 I made the test page to throw an exception, and I have all the raygun webconfig stuff handled

 So nothing is being sent, and I'm assuming it's because the logger just isn't being attached in the PreApplicationStart method

 Is there some trick to this?

Posted by Community Admin on 11-Aug-2014 00:00

Hello Steve,

Could you please copy both the ExternalLogging.dll and Mindscape.Raygun4Net.dll in your projects bin folder and add references to them.

Afterwards modify the web.cofig file of your Sitefinity application and configure it to use Raygun:

  • Add the following section to configSections: <section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net"/>
  • Add the Raygun settings configuration block: <RaygunSettings apikey="YOUR_APP_API_KEY" />
  • NOTE: You can check the Raygun GitHub readme for additional information on how to configure your application's web.config file.

Please let me know if this helps.

Nader Dabour
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 11-Aug-2014 00:00

No, there's no problem with the way raygun is setup...it's already logging by itself (has been for a long time)

The problem is I need to modify the code in the sample to send up custom data and the sf version\etc...I just want the code to live in my assembly instead of needing to attach a separate project for something so trivial...know what I mean?

 

Posted by Community Admin on 11-Aug-2014 00:00

Hello Steve,

In order to execute the external logging logic from whitin your SitefinityWebApp project you will need to add a Global.asax file that handles the log configuring once the Application_Start method is called:

using ExternalLogging;
using System;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Logging;
using Telerik.Microsoft.Practices.Unity;
  
namespace SitefinityWebApp
    public class Global : System.Web.HttpApplication
    
        protected void Application_Start(object sender, EventArgs e)
        
            Log.Configuring += Log_Configuring;
        
  
        private static void Log_Configuring(object sender, LogConfiguringEventArgs e)
        
            var defaultConfigurator = ObjectFactory.Resolve<ISitefinityLogCategoryConfigurator>();
            var customConfigurator = new RaygunConfigurator(defaultConfigurator, ConfigurationPolicy.ErrorLog);
            ObjectFactory.Container.RegisterInstance<ISitefinityLogCategoryConfigurator>(customConfigurator);
        
    

Alternatively you can use the PreApplicationStart method as shown in the Installer class of the external-logging sample. If you prefer this case you will need to add  the name of the method that will be executed in your project's AssemblyInfo.cs file:
[assembly: System.Web.PreApplicationStartMethod(typeof(Installer), "PreApplicationStart")]

Both of the cases mentioned above will require a reference to the Mindscape.Raygun4Net.dll file.

Regards,
Nader Dabour
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed