Raygun error and crash reporting for Episerver

Frederik Vig 2016-05-22 12:42:48

For us the main difference between Raygun and other error logging tools has been the maintenance aspect where it groups similar errors together, gives you details like the HTTP request data, browser environment and allows you to ignore, assign, mark as solved and also integrate with other tools we use like Octopus Deploy, GitHub and JIRA, and of course alerts to the right people. 


You can try out Raygun for free for 30 days. Go to https://app.raygun.com and register, add your application (if it's not already there). This will give you an API key to use.

Install the following package:

Install-Package Mindscape.Raygun4Net.Mvc


Note: we only do this for production configurations.


Add a section to configSections:

<section name="RaygunSettings" type="Mindscape.Raygun4Net.RaygunSettings, Mindscape.Raygun4Net"/>

Add the Raygun settings configuration block from above:

<RaygunSettings apikey="YOUR_APP_API_KEY" />

For system.web:

<add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>

For system.webServer:

<add name="RaygunErrorModule" type="Mindscape.Raygun4Net.RaygunHttpModule"/>


By default Raygun will catch all errors automatically from Application_Error. There's also a provider for Log4Net that you can use as an appender.

Here's an example configuration to append errors from Log4Net to Raygun. 

Install-Package log4net.Raygun


<?xml version="1.0" encoding="utf-8"?>
<appender name="errorFileLogAppender" type="log4net.Appender.RollingFileAppender" >
<!-- Consider moving the log files to a location outside the web application -->
<file value="..\appdata\SiteErrors.log" />
<encoding value="utf-8" />
<staticLogFileName value="true"/>
<datePattern value=".yyyyMMdd.'log'" />
<rollingStyle value="Date" />
<threshold value="Error" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger: %message%n" />
<appender name="outputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="[%thread] %level %logger: %message%n" />
<appender name="RaygunAppender" type="log4net.Raygun.RaygunAppender, log4net.Raygun">
<apiKey value="API-KEY" />
<retries value="15" />
<timeBetweenRetries value="00:01:00" />
<onlySendExceptions value="true" />
<logger name="EPiServer.Core.OptimisticCache" additivity="false">
<level value="Error" />
<logger name="EPiServer.Core.ContentProvider" additivity="false">
<level value="Error" />
<logger name="EPiServer.Data.Dynamic.Providers.DbDataStoreProvider" additivity="false">
<level value="Error" />
<logger name="EPiServer.Data.Providers.SqlDatabaseHandler" additivity="false">
<level value="Error" />
<logger name="EPiServer.Data.Providers.ConnectionContext" additivity="false">
<level value="Error" />
<level value="Error" />
<appender-ref ref="RaygunAppender" >
<threshold value="Error" />