Adding Gibraltar to your ASP.NET website without recompiling

Welcome to day 24 of our Advent calendar. Yes folks, only one more sleep until Christmas.

Today we’re going to look at a great way to start using Gibraltar for logging even if you’ve got a deployed application. After all, not all web sites are in development and sometimes you want to add logging without making any code changes. So in this post we’re going to look at how you can add Gibraltar logging with a few simple changes to configuration, and the copying of the Gibraltar libraries to your web site.

The first thing you need to do is copy the Gibraltar libraries into your web site’s bin folder. The two libraries you need are:

  • Gibraltar.Agent.dll
  • Gibraltar.Agent.Web.dll

These are both in the SDK folder in your Gibraltar installation.

Next you must modify the web.config file to add reference to these libraries, in the modules and health monitoring sections. You web.config should end up looking something like this:

<configuration>
  <system.web>
    <httpModules>
      <add name="RequestTrackingModule" type="Gibraltar.Agent.Web.RequestTrackingModule, Gibraltar.Agent.Web"/>
    </httpModules>
    <healthMonitoring enabled="true" heartbeatInterval="0">
      <profiles>
        <add name="GibraltarProfile" minInstances="1" maxLimit="Infinite"
             minInterval="00:00:00"/>
      </profiles>
      <providers>
        <add name="Gibraltar"
             type="Gibraltar.Agent.Web.GibraltarEventProvider, Gibraltar.Agent.Web"/>
      </providers>
      <rules>
        <add name="Gibraltar Event Provider" eventName="All Events"
             provider="Gibraltar" profile="GibraltarProfile"/>
      </rules>
    </healthMonitoring>
  </system.web>
  <system.webServer>
    <modules>
      <add name="RequestTrackingModule"
           type="Gibraltar.Agent.Web.RequestTrackingModule, Gibraltar.Agent.Web"/>
    </modules>
  </system.webServer>
</configuration>

That’s it. Just save the config file, access your website, and Gibraltar will start logging the default events for you. Of course, you won’t get custom errors, but you will get notification of failures, which is the most important part of logging.

Note: Changing your web.config file will restart your application, losing all state. It’s best to do this as part of scheduled maintenance so your users don’t lose anything.

To read more on the configuration options, head to our documentation.

Well, that’s the end of our Christmas Advent calendar. Remember to tell us what feature is on your Gibraltar Software Christmas List? Share your ideas with us on Facebook and you’ll have a chance to win a fantastic prize!

Have a great Christmas everyone. I hope you’ve been good this year and Santa brings you what you wished for.

Related Posts

PostSharp Diagnostics Now Supports Loupe in the Box

The latest update to PostSharp Diagnostics adds Loupe support, enabling extensive high-performance logging to be added to any .NET application with virtually no code changes. PostSharp even has a great free option for developers that complements Loupe Desktop! Read more

Loupe Agent for .NET Core Now Available

The first release of the Loupe Agent for .NET Core is also our first open source version of the Loupe Agent. This is the first step in our plan to open source the entire Loupe Agent to make it easier for anyone to extend and take advantage of what Loupe... Read more

We've Moved Loupe Service to App.OnLoupe.Com

Loupe Service now has a shorter, direct site name that's faster, anywhere in the world. Just to go App.OnLoupe.Com, the new CDN-accelerated endpoint for the Loupe Service. Your existing Agents and Loupe Desktops are unaffected by this change, but access to the web UI will be redirected to the new... Read more

Rock solid centralized .NET logging

Unlimited applications, unlimited errors, scalable from solo startup to enterprise.