Category Archives: Raygun.io

Raygun.io vs. Airbrake.io – .NET Error Logging Comparison

Today I’m going to talk about two SAAS based error logging solutions for .NET; Raygun.io and Airbrake.io. I was recently contacted by the community manager for Raygun and was asked to give their solution a try. I was already using Airbrake but had not been very impressed with the level of detail we were getting with Airbrake. While Airbrake was working really well for our Ruby based projects it wasn’t reporting the same level of details for our .NET projects. I decided to give Raygun a try and I’m super happy that I did. Let me cover some of the reasons why I like Raygun over Airbrake.

Raygun provides a super easy implementation to get started with using their product. You can download their library from NuGet via searching for their package name; Mindscape.Raygun4Net. Once Raygun is installed into the project you are working on, you are ready to go. Raygun even generates the code you will need to create a reference to their library along with your specific project key that Raygun uses to ensure you are the only one that can view your errors and that your errors do not appear in another users account. Using a key is standard practice for third party SAAS based solutions to keep information segmented but most solutions do not generate code for you to get started. While it is only 1 line of code it still is a nice little feature that can be taken for granted by many developers. After the library is initialized it takes one more line of code, at minimum, to start sending errors to Raygun. Here is an example of all the code that is necessary to get started.

public void SendErrorToThirdPartyLogger(Exception ex)
{
    var client = new RaygunClient("raygun_api_key");
    client.Send(ex);
}

It doesn’t get much easier then that to get started with sending your exceptions to a third party solution. All the instructions to get started will be listed for you in your account on Raygun’s website.

Airbrake is very similar to Raygun when it comes to installing it however there are a few differences. You can download the Airbrake library from NuGet but don’t try searching for Airbrake because the package you need is called Sharpbrake. The Sharpbrake package is also dependent upon another package titled Common.Logging but that will be automatically installed by NuGet. Once you have the Sharpbrake package installed you’ll need to go through 1 more step of configuring the api key and a few other settings in your applications .config file. This is one step that Raygun didn’t need. Once you setup your .config file with the below parameters you can get started using Sharpbrake in your application. Below is an example of the settings you need to implement in your .config file as well as some sample code to actually log errors to Airbrake.

Config File Settings Example for Airbrake

<appSettings>
  <add key="Airbrake.ApiKey" value="1234567890abcdefg" />
  <add key="Airbrake.Environment" value="Whatever" />
  <add key="Airbrake.ServerUri" value="Airbrake server url (optional)" />
</appSettings>

Simple Sharpbrake Implementation Example

public static void SendErrorToThirdPartyLogger(Exception ex)
{
    ex.SendToAirbrake();
}

Although Sharpbrake is only 1 line of code the extra steps of configuring your applications config file is the difference in the setup between Airbrake and Raygun. I think this is where the simplicity of Raygun comes into play. Here’s one example why. When I implemented Airbrake’s solution it was in a Windows Service application. To get errors to be logged to Airbrake I had to implement the Airbrake config settings in the windows service project and not in the config file of the project in which I had the method to log errors to Airbrake. This in turn caused me to have to implement the Sharpbrake and Common.Logging libraries in the windows service project since that was where the config settings were. This meant that I had to have the libraries in 2 projects; the windows service project and the project that had the actual logging code. I had to do this in approx. 5 different solutions because I have 5 different windows services I was using. Keeping track of references and config file settings is not something that is easy to do and requires a good bit of automation to ensure no issues occur when moving into different environments. To be able to change the environment config setting per environment I had to ensure that this value was updated during our build process for each environment. If you don’t have an automated build process this can be a tedious task that can lead to mistakes.

As far as pricing for Raygun and Airbrake they are both pretty similar and offer different pricing options for any number of budgets. However one thing that Airbrake does have that Raygun doesn’t have is a free tier. Now you don’t get a whole lot with the free tier on Airbrake but having something is better then nothing. The smallest option for Raygun is the micro option which is $9 a month and includes 1 monitored application, unlimited users, 14 days of data retention and up to 5k errors per month that can be stored. I don’t know about you but if I have 5k errors in my application in a month then I have serious issues and probably shouldn’t be writing code. So let’s say you are a small business and really want to be able to monitor all three of your environments for your application; development, staging and production. The next package up that Raygun offers is $29 a month which gives you 5 applications but you might only really need 3 for your 1 application and you just feel that $29 a month is too much to spend for tracking your errors. Here is a little tip that you can use to stay on the micro tier. Raygun offers that ability for you to add tags to the errors you send in to Raygun. Here is an example of what I did while testing out Raygun.

public void SendErrorToThirdPartyLogger(Exception ex)
{
    // set a default environment
    var environment = "development";
    // grab the environment setting from our app.config file
    if (ConfigurationManager.AppSettings["env"] != null)
        environment = ConfigurationManager.AppSettings["env"].Trim();

    // create a new tag element that contains the current environment 
    var tags = new List<string> {environment};

    // initialize the raygun client
    var client = new RaygunClient("raygun_api_key");
    // send the error to raygun
    client.Send(ex, tags);
}

I used our app.config file to set the environment during our build process so everything was automated and I didn’t have to worry about manually changing the environment setting. Now whenever an error comes into Raygun I can check to see what environment the issue occurred in and determine the priority of the error.

Moving on to the Raygun portal this is where the big difference between Raygun and Airbrake come in to play in my opinion. Raygun provides a really nice graph that shows how many errors occurred over the past seven days. For one it provides a quick visual that easily allows me to see if a new release is causing a lot of errors. Airbrake doesn’t have any charts or graphs like this. Here is a screenshot of the graph.

Raygun.io Error Graph Sample

Raygun.io Error Graph

Finally I’d like to discuss the major difference between Raygun and Airbrake and that is the level of detail you get. Raygun provides a full stacktrace of the error, the time of the error, the class name for the error and even the server environment specs. With Airbrake you only get the time of the error and very basic error information. You don’t get a full stacktrace of the error or any environment specs. Not having the full stacktrace really hinders your ability to troubleshoot issues in a timely manner and in a production environment fixing issues quickly is key. Here are some sample screen shots from actual errors from both solutions. I would like to note that I also cut out some of the details in the Raygun screenshot as they were specific to my application and I didn’t want to give out details of my application.

Raygun.io error detail

Raygun.io Stacktrace Detail

Raygun.io Stacktrace Detail

Airbrake.io error detail

Airbrake.io Error Detail

Airbrake.io Error Detail

As you can see from the screen shots there really is no comparison to the level of detail you get between Raygun and Airbrake. Raygun is far superior.

I’ve been using Raygun for just over 2 weeks now and I’ve been really impressed. Installation was super easy and it actually took me longer to remove all the Sharpbrake setup and Nuget package installations then it took me to install and start using Raygun. Pricing for both solutions is reasonable but I feel that you get more with Raygun for the price you pay then you do with Airbrake. My only complaint is that both Raygun and Airbrake need to do a better job with getting their sites working on mobile devices. I had a hard time viewing error information on my iPhone and if I’m out and about and errors come in I want to know exactly what the problem is. You might be asking how do you know if errors occur when you are not in front of your computer. Both solutions offer email notifications when errors come in so you can stay on top of things which is a great feature and probably worth the cost of either solution alone in my opinion.

Finally, I would like to note that this comparison is just based on the .NET implementations of both solutions. My colleague Scott Bradley will be doing a blog post soon about comparing the ruby implementations of Raygun vs. Airbrake. Here is a link to his blog.

Well that’s it for today. Hopefully this helped give you an overview of Raygun.io and Airbrake.io and why I would choose Raygun.io over Airbrake.io for .NET error logging.