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

Loupe 4.5 Released with New Log Viewer for Web

Rapidly diagnose each error in any .NET application with our new Web Log Viewer and Exception root cause analysis, new in Loupe 4.5. New integration with Azure Service Bus and Azure Search enables full Loupe functionality without any Virtual Servers in Azure. Read more

Cloudflare Vulnerability Does Not Affect Us

The recently reported Cloudflare vulnerability where fragments of secure, encrypted user data could be exposed to a third party does not affect Gibraltar Software even though we use Cloudflare because we only route static content through the Cloudflare proxy for acceleration. Read more

We're out of our Last Data Center

Back in January of 2016 we decided to completely transition out of our data centers and into the cloud. On Sunday we finally shut down the last cluster of our hardware. Read more for how we did it and whether we would do it all over again if we had... Read more

Rock solid centralized .NET logging

Unlimited applications, unlimited errors, starting at $25/month