Getting Started - Introduction
Loupe - Log - Monitor - Resolve
Loupe / Getting Started - Introduction
In This Topic
    Getting Started - Introduction
    In This Topic

    Step 1: Add Loupe to Your Application

    Start by adding the Gibraltar Loupe Agent for ASP.NET MVC and Web API NuGet package to your web project. This will add the basic Loupe Agent and the ASP.NET MVC agent which records performance and error information for MVC and Web API.

    To activate the MVC agent you need to add a few lines of code to your site startup to register the filters:

    using Gibraltar.Agent;
    using Gibraltar.Agent.Web.Mvc.Filters;
    public class MvcApplication : System.Web.HttpApplication
    {
      protected void Application_Start()
      {
        Log.StartSession(); //Prompt the Loupe Agent to start immediately
        //Register the three filters
        GlobalConfiguration.Configuration.Filters.Add(
            new WebApiRequestMonitorAttribute());
        GlobalFilters.Filters.Add(new MvcRequestMonitorAttribute());
        GlobalFilters.Filters.Add(new UnhandledExceptionAttribute());
      }
    }
    

    For more details on how to integrate Loupe see Using Loupe with ASP.NET MVC

    Add the Gibraltar Loupe Agent for ASP.NET WebForms NuGet package to your web project. This will add the basic Loupe Agent and the ASP.NET WebForms agent which automatically records performance and error information for ASP.NET.

    For more details on how to integrate Loupe see Using Loupe with ASP.NET WebForms

    Start by adding the Gibraltar Loupe Agent NuGet package to your WPF project.

    To integrate Loupe with WPF, add a couple lines to your App class and Loupe will log all unhandled exceptions:

    using System.Windows;
    using Gibraltar.Agent;
    public partial class App : Application
    {
      public App() {
        DispatcherUnhandledException += (sender, e) => {
               Log.ReportException(e.Exception, "Unhandled", true, false);
               e.Handled = true;
           };
      }
      protected override void OnStartup(StartupEventArgs e) {
        Log.StartSession();
        base.OnStartup(e);
      }
      protected override void OnExit(ExitEventArgs e) {
        Log.EndSession();
        base.OnExit(e);
      }
    }
    

    For more details on how to integrate Loupe see Using Loupe with WPF

    Start by adding the Gibraltar Loupe Agent NuGet package to your WinForms project.

    To integrate Loupe with WinForms, add a couple lines to your Program class and Loupe will log all unhandled exceptions:

    using System.Windows;
    using Gibraltar.Agent;
    static class Program
    {
      [STAThread]
      static void Main()
      {
        Log.StartSession();
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
        Log.EndSession();
      }
    }
    

    For more details on how to integrate Loupe see Using Loupe with WinForms

    Start by adding the Gibraltar Loupe Agent NuGet package to your Windows Service project.

    To integrate Loupe with your service, add a couple lines to your Service class and Loupe will log all unhandled exceptions:

    using System.Windows;
    using Gibraltar.Agent;
    public partial class YourService : ServiceBase
    {
      public YourService()
      {
        InitializeComponent();
      }
      protected override void OnStart(string[] args)
      {
        Log.StartSession();
      }
      protected override void OnStop()
      {
        Log.EndSession();
      }
    }
    

    For more details on how to integrate Loupe see Using Loupe with Windows Services

    Step 2: Configure Your App to Send Data to Loupe Server

    Once you've instrumented an application you'll want to set up a connection with Loupe Server so you can collect data from everywhere your application runs and start managing errors.  Add this configuration to your app.config / web.config to send data to this server automatically in the background.  You'll need to make a few changes to this XML to have it work:

    <configuration>
      <configSections>
        <sectionGroup name="gibraltar">
          <section name="publisher" type="Gibraltar.Agent.PublisherElement, Gibraltar.Agent" />
          <section name="server" type="Gibraltar.Agent.ServerElement, Gibraltar.Agent" />
        </sectionGroup>
      </configSections>
      <gibraltar>
        <publisher productName="Your Product" applicationName="Your Application" />
        <server autoSendSessions="True" sendAllApplications="True" useGibraltarService="True" customerName="Your Loupe Service Name"  />
      </gibraltar>
    </configuration>
    
    Sign into the web UI for Loupe to see an exact, customized snippet of this XML with your server configuration embedded in it.

    Loupe has extensive configuration options to tune what it collects and how that information is presented to the server. Check out Common Agent Configuration Scenarios for more details.

    Step 3: Run Your Application Anywhere

    Data gets recorded by Loupe and uploaded to the server automatically once each log files is closed. Files get closed when your application exists or when an error is recorded.

    Files get sent to the server in the background on a low-priority thread; let your application run for a minute to give the background task time to start and send data. Once data has been sent to the server, you'll see it show up within a few moments.

    We're Here to Help

    We're committed to making Loupe an indispensable tool for you and your team. If you're not delighted, neither are we. Please email us at Support@GibraltarSoftware.com. or click to chat if you're having trouble.

    Where To Next?

    See Also