RecurringBugCatcher 1.0.3

Log exceptions and get notified when same/similar exceptions keep occurring in your solution. Works hand-in-hand and as a complement to your favorite logger

Install-Package RecurringBugCatcher -Version 1.0.3
dotnet add package RecurringBugCatcher --version 1.0.3
<PackageReference Include="RecurringBugCatcher" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RecurringBugCatcher --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Recurring Bug Catcher

What does it do?

Sometimes, applications throw exceptions and whilst these are usually handled and logged, they may go unnoticed for a period of time.
Unnoticed exceptions can sometimes hide a problem that, whilst not immediately apparent, could have significant negative impact on the software.

Recurring Bug Catcher monitors any handled exception you tell it to track and when a particular exception message occurs multiple times (or enough times), bug catcher will notify anyone subscribed by email such as Devs or support people. Note: The recurring exception messages do not have to all be exactly the same. They can be in the 90 percentiles textually the same to be considered as the "same" type of problem re-occurring. This allow for slight variances in the message that can sometimes occur for the same recurring error. Bug-catcher is also smart, in that it does not keep emailing persistently and fill up your email box with stacks of unwanted notification. Error messages previously reported are not re-emailed.

When an email notification is received from Recurring Bug Catcher, the developer or support person should go and consult the application's exception logs to investigate and troubleshoot as required. This is the intended method of use.

Let's face it. Nobody just sits in front a computer monitoring logs. And we all have experienced recurring messages in our logs. The purpose of Recurring Bug Catcher is to make developers aware when recurring exceptions are happening to provide a chance early in the piece to address issues before users are impacted or before users become aware of the issue.

Pre-requisite

You should be handling and logging exception in your application. (E.g. using NLog, log4net, etc...)

How to use it?

Add the NuGet package to any project of your choice and follow the code example provided below.

C# Example

// Include the following using statements
using BugCatcher.Class.Interfaces;
using BugCatcher.Class.Implementation;


// Initialise the manager
var bugCatcherManager = BugCatcherManager.Get;

// Configure the SMTP parameters for sending a notification when 
// the same exception keeps occurring
bugCatcherManager.ConfigureSmtp(
		smtpHost: "SmtpHostAdress",
		fromEmailAddress: "bugcatcher-notification@domain.com",
		toEmailAddress: "someone@domain.com",
		smtpPort: 25);

// Initialise the API
var bugCatcherApi = bugCatcherManager.BugCatcherApi();

// Example usage
// Tell Recurring Bug Catcher to track exceptions in catch blocks
try
{
	// Do something
}
catch (Exception exception)
{
        var exceptionMessage = 
             $"Error occurred: {exception.Message}. Details: {exception.Exception}";

	// 1. Log using your usual logging library (e.g. NLog, log4net etc...)
	// This log is what you would consult if you receive an email
        // notification from Recurring Bug Catcher 
	myUsualLogger.Error(exceptionMessage);

	// 2. Tell bug catcher to monitor this exception. If the same or similar 
	// exceptionMessage text occurs multiple times (in this example 5 times)
        // then a notification is generated
	BugCatcherApi.MonitorException(
                  exceptionMessage, 
                  threshold: 5);
}

Use Case

Q: Should you log all exceptions with Bug Catcher?
A: No, not everything.
Essentially you'd favour logging exceptions mainly for repeating processes.
Example: Inside loops or methods that get called repeatedly or multiple times.

Non-Blocking

Note: The call to BugCatcherApi.MonitorException(exceptionMessage) is non-blocking and returns immediately whilst bug catcher works separately in a foreground thread and completes its job even if your application exits beforehand ;P

Light-Weight

Bug catcher has been designed to be light on resource usage.

Configuration

Installing the NuGet package automatically adds the necessary entries to your App.config or Web.config file (also removes them if you uninstall the package)

In case the modifications to your configuration file fail, you can paste/or remove the following manually:

<entityFramework>

<defaultConnectionFactory
  type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework" />

<providers>
 <provider
  invariantName="System.Data.SQLite" 
  type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
 <provider
  invariantName="System.Data.SqlClient" 
  type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
 <provider
  invariantName="System.Data.SQLite.EF6" 
  type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
  </providers>

</entityFramework>

<connectionStrings>
    <add name="BugCatcherEntities" connectionString="metadata=res://*/BugCatcherModel.csdl|res://*/BugCatcherModel.ssdl|res://*/BugCatcherModel.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=..\..\..\packages\RecurringBugCatcher.1.0.3\lib\net461\Database\BugCatcher.sqlite&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

<system.data>
  <DbProviderFactories>
    <remove invariant="System.Data.SQLite.EF6" />
    <add 
       name="SQLite Data Provider (Entity Framework 6)" 
       invariant="System.Data.SQLite.EF6"
       description=".NET Framework Data Provider for SQLite (Entity Framework 6)"
       type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
  <remove invariant="System.Data.SQLite" />
  <add
     name="SQLite Data Provider"
     invariant="System.Data.SQLite"
     description=".NET Framework Data Provider for SQLite"
     type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
 </DbProviderFactories>
</system.data>

Recurring Bug Catcher

What does it do?

Sometimes, applications throw exceptions and whilst these are usually handled and logged, they may go unnoticed for a period of time.
Unnoticed exceptions can sometimes hide a problem that, whilst not immediately apparent, could have significant negative impact on the software.

Recurring Bug Catcher monitors any handled exception you tell it to track and when a particular exception message occurs multiple times (or enough times), bug catcher will notify anyone subscribed by email such as Devs or support people. Note: The recurring exception messages do not have to all be exactly the same. They can be in the 90 percentiles textually the same to be considered as the "same" type of problem re-occurring. This allow for slight variances in the message that can sometimes occur for the same recurring error. Bug-catcher is also smart, in that it does not keep emailing persistently and fill up your email box with stacks of unwanted notification. Error messages previously reported are not re-emailed.

When an email notification is received from Recurring Bug Catcher, the developer or support person should go and consult the application's exception logs to investigate and troubleshoot as required. This is the intended method of use.

Let's face it. Nobody just sits in front a computer monitoring logs. And we all have experienced recurring messages in our logs. The purpose of Recurring Bug Catcher is to make developers aware when recurring exceptions are happening to provide a chance early in the piece to address issues before users are impacted or before users become aware of the issue.

Pre-requisite

You should be handling and logging exception in your application. (E.g. using NLog, log4net, etc...)

How to use it?

Add the NuGet package to any project of your choice and follow the code example provided below.

C# Example

// Include the following using statements
using BugCatcher.Class.Interfaces;
using BugCatcher.Class.Implementation;


// Initialise the manager
var bugCatcherManager = BugCatcherManager.Get;

// Configure the SMTP parameters for sending a notification when 
// the same exception keeps occurring
bugCatcherManager.ConfigureSmtp(
		smtpHost: "SmtpHostAdress",
		fromEmailAddress: "bugcatcher-notification@domain.com",
		toEmailAddress: "someone@domain.com",
		smtpPort: 25);

// Initialise the API
var bugCatcherApi = bugCatcherManager.BugCatcherApi();

// Example usage
// Tell Recurring Bug Catcher to track exceptions in catch blocks
try
{
	// Do something
}
catch (Exception exception)
{
        var exceptionMessage = 
             $"Error occurred: {exception.Message}. Details: {exception.Exception}";

	// 1. Log using your usual logging library (e.g. NLog, log4net etc...)
	// This log is what you would consult if you receive an email
        // notification from Recurring Bug Catcher 
	myUsualLogger.Error(exceptionMessage);

	// 2. Tell bug catcher to monitor this exception. If the same or similar 
	// exceptionMessage text occurs multiple times (in this example 5 times)
        // then a notification is generated
	BugCatcherApi.MonitorException(
                  exceptionMessage, 
                  threshold: 5);
}

Use Case

Q: Should you log all exceptions with Bug Catcher?
A: No, not everything.
Essentially you'd favour logging exceptions mainly for repeating processes.
Example: Inside loops or methods that get called repeatedly or multiple times.

Non-Blocking

Note: The call to BugCatcherApi.MonitorException(exceptionMessage) is non-blocking and returns immediately whilst bug catcher works separately in a foreground thread and completes its job even if your application exits beforehand ;P

Light-Weight

Bug catcher has been designed to be light on resource usage.

Configuration

Installing the NuGet package automatically adds the necessary entries to your App.config or Web.config file (also removes them if you uninstall the package)

In case the modifications to your configuration file fail, you can paste/or remove the following manually:

<entityFramework>

<defaultConnectionFactory
  type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework" />

<providers>
 <provider
  invariantName="System.Data.SQLite" 
  type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
 <provider
  invariantName="System.Data.SqlClient" 
  type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
 <provider
  invariantName="System.Data.SQLite.EF6" 
  type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
  </providers>

</entityFramework>

<connectionStrings>
    <add name="BugCatcherEntities" connectionString="metadata=res://*/BugCatcherModel.csdl|res://*/BugCatcherModel.ssdl|res://*/BugCatcherModel.msl;provider=System.Data.SQLite.EF6;provider connection string=&quot;data source=..\..\..\packages\RecurringBugCatcher.1.0.3\lib\net461\Database\BugCatcher.sqlite&quot;" providerName="System.Data.EntityClient" />
</connectionStrings>

<system.data>
  <DbProviderFactories>
    <remove invariant="System.Data.SQLite.EF6" />
    <add 
       name="SQLite Data Provider (Entity Framework 6)" 
       invariant="System.Data.SQLite.EF6"
       description=".NET Framework Data Provider for SQLite (Entity Framework 6)"
       type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
  <remove invariant="System.Data.SQLite" />
  <add
     name="SQLite Data Provider"
     invariant="System.Data.SQLite"
     description=".NET Framework Data Provider for SQLite"
     type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" />
 </DbProviderFactories>
</system.data>

Release Notes

Initial publication

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.3 235 4/29/2019
1.0.2 206 4/27/2019
1.0.1 188 4/27/2019
1.0.0 401 4/21/2019