Add Loupe to Your Project

Start by adding the Gibraltar Loupe Agent for ASP.NET MVC and Web API NuGet package

Enable Exception Logging

Add a couple lines to your App class and Loupe will log all unhandled exceptions.

using Gibraltar.Agent;
using Gibraltar.Agent.Web.Mvc.Filters;

public class MvcApplication : System.Web.HttpApplication
    protected void Application_Start()
        // Initialize Gibraltar Loupe
        GlobalConfiguration.Configuration.Filters.Add(new WebApiRequestMonitorAttribute());
        GlobalFilters.Filters.Add(new MvcRequestMonitorAttribute());
        GlobalFilters.Filters.Add(new UnhandledExceptionAttribute());

Add Loupe Server for Exception Reporting

Add a couple more lines and Loupe Server will centralize log collection, analysis and error management.  This can be done in your application configuration file:

<?xml version="1.0"?>
        <sectionGroup name="gibraltar">
            <section name="server"
                        type="Gibraltar.Agent.ServerElement, Gibraltar.Agent" />
        <server autoSendSessions="true"
                customerName="YOUR LOUPE SERVICE ACCOUNT" />
        <!-- If you have an on-premises Loupe Server, use this instead:
        <server autoSendSessions="true"
                server="YOUR LOUPE SERVER" /> -->

Or in source code

protected void Application_Start()
    Log.Initializing += Log_Initializing;
    // ...

private void Log_Initializing(object sender, LogInitializingEventArgs e)
    var server = e.Configuration.Server;
    server.AutoSendSessions = true;

    server.UseGibraltarService = true; // Using subscription Loupe Service
    server.CustomerName = &quot;YOUR LOUPE SERVICE ACCOUNT&quot;;

    // server.UseGibraltarService = false; // Using on-premises Loupe Server
    // server.Server = &quot;YOUR LOUPE SERVER&quot;;

That was easy! What's Next?

With just these few steps you're now collecting crucial details on every error, recording performance metrics and logging every trace message your program emits.

Learn more about Loupe in our Developers Guide.