External Logging Sample
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?
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:
<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net"/>
<RaygunSettings apikey="YOUR_APP_API_KEY" />
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?
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"
)]