Getting to Know Loupe - Making a Start

Hello there. My name is Gary Short and I’ve recently joined Gibraltar Software. Amongst the other things I’ll be doing (more details on those later) I’ll be evangelising the Loupe product.

Now I’ve never used the product and I don’t know anything about it, so I guess I’m on the same sort of learning curve as a new customer when they first download a trial version.

We all learn in different ways and at different speeds, but the way I learn best is through action centred learning, in other words, I like to “do stuff” to learn how “stuff works”. So, the best way for me to learn how to do something with Loupe, is to do something with Loupe.

So what’s the simplest thing I can do to get something working? Well after having a quick look at the documentation, it seems to me that the simplest thing to do is:

  1. Configure a minimalist application for tracing
  2. Hook up Loupe
  3. Examine the data in Loupe.

Okay, so let’s do that!

Step 1. Configure a Minimalist Application For Tracing

Let’s work with the simplest thing, namely a console application with one method and a couple of calls to the Tracing API. Something like this should fit the bill:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using Gibraltar.Agent;

namespace GibraltarGettingStartedApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Trace.WriteLine("Entered method!");
            Console.WriteLine("In the body of the method!");
            Trace.WriteLine("Leaving method!");
        }
    }
}

And when we run this, it does pretty much as we’d expect it to do:

SNAGHTML1cd40ddc

image

Step 2. Hook up Loupe

Firstly, start Loupe and from the and click the “Add Loupe Now” button:

image

Then, simply work your way through the wizard. Starting with selecting the project file for your application:

SNAGHTML1cdaa960

Next, since we’re doing the simplest thing possible, accept the default configuration:

SNAGHTML1cdbcbed

Then deselect all the checkboxes.With the exception of “Allow Sessions to be Emailed to you”, which I can guess at, I have no idea what these do, but we’ll find out later. For now, we just want to do the simplest thing that’ll work.

SNAGHTML1ce275e2

And we’re done:

SNAGHTML1ce31a6a

Okay so let’s run our application again.

SNAGHTML1d52aa8a

Hmm, notice that the console window stays open this time, and we have to physically close it to make our application end – what’s happening here I wonder? We’ll come back and investigate that in a moment, but for now, let’s see what information is available in Loupe.

Step 3. Examine the Data in Loupe

Open Loupe and select “New Sessions”

image

and in the right hand pane, we see that we do indeed have information from our application! Smile

Now it’s time to investigate that “application is still running” oddity. Looking at the information we can see that the “status” is  “crashed”, even though we closed it down properly.

image

My guess as to what is going on here is that the Loupe Agent is holding open the application after the execution path has reached the end of the Main() method. We then closed the window manually, and because our application didn’t end in the way Loupe expected, it’s marked this event as a “crash”. It’s time to look up the documentation and find out what’s going on.

A quick read of the documentation at:

doc.onloupe.com

Shows us that indeed, when we are using a console application, we are responsible for ending the session. We can also see that there are a number of ways to do this, but since we are trying the simplest possible thing that will work, we’ll just add the Trace.Close() call to the end off our application. So now our code looks like this:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using Gibraltar.Agent;

namespace GibraltarGettingStartedApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Trace.WriteLine("Entered method!");
            Console.WriteLine("In the body of the method!");
            Trace.WriteLine("Leaving method!");
            Trace.Close();
        }
    }
}

If we run our application now, we can see that our application closes when we get to the end of the Main() method. If we look in Loupe we can also see that our application has closed normally:

image

Okay, I think that is enough for this post. To help us learn how Loupe works, we’ve build a minimalist application and enabled Loupe to record our trace information. In the next post, we’ll build on these beginnings by looking at what happens when our application throws and error. We’ll also find out if Loupe deals with handled and unhandled exceptions differently.

Until next time, happy coding!

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.