+1-888-365-2779
Try Now
More in this section

Forums / Sitefinity SDK / External Logging Sample

External Logging Sample

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    06 Aug 2014
    Link to this post

    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?

  2. Nader Dabour
    Nader Dabour avatar
    12 posts
    Registered:
    06 Dec 2016
    11 Aug 2014
    Link to this post
    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
     
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    11 Aug 2014 in reply to Nader Dabour
    Link to this post

    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?

     

  4. Nader Dabour
    Nader Dabour avatar
    12 posts
    Registered:
    06 Dec 2016
    11 Aug 2014
    Link to this post
    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
     
4 posts, 0 answered