Using Loupe with Trace

Behind Advent door number 19 is a simple treat - how to use Loupe with the logging capabilities of .NET.

As soon as the Loupe Agent is started within a process it begins listening to a number of sources of information, including:

  • Trace Messages:  Anything sent to System.Diagnostics.Trace will be routed into the Agent.
  • Console Messages: If you write text to System.Console it will be copied into the Agent as well as sent on to any Console.
  • Debug Messages: In a debug build anything written to System.Diagnostics.Debug will be output to any Trace listener and therefore routed to the Agent.

Since many third-party and Microsoft components send useful information to Trace Loupe automatically registers itself as a Trace Listener as soon as the agent is loaded (as well as registering to get a copy of all console messages) so there’s no configuration needed on your part.  The only thing you need to worry about is that the Loupe Agent is actually started and eventually told to shut down.  If you’re running in an ASP.NET application there’s nothing to do for this- the Gibraltar Agent for ASP.NET takes care of it all.  Otherwise, you should explicitly start the agent early on in your application’s lifecycle and then shut it down when you’re sure your application is exiting.  For details see:

After that, you can freely send information strait to Trace, Debug, or Console and be sure that it’ll be captured by the Loupe Agent.  If you have a third-party library that supports Trace you can enable that logging and it’ll get captured as well.

*Whew* That was easy!

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