Git Product home page Git Product logo

logging.exceptionsender's Introduction

Logging.ExceptionSender

ExceptionSenderMiddleware watches for unhandled exceptions. When found - details are saved to text files in specific folder.

ExceptionSenderTask monitors that folder and sends exception info to you by email (using MailGun.com, but you can add your own)

Written for ASP.NET Core (ASP.NET 5, ASP.NET vNext) projects.

NuGet

Main features

  • Exception message and stacktrace are captured;
  • Last N log records captured (Logging.Memory is used);
  • Captured data saved in logs subdirectory for later processing;
  • Task (based on RecurrentTasks) is used for checking new exception data;
  • Every single exception - one email to you;
  • MailGun is used to send emails (free quota 10K emails/month), you can add new mail providers (inherit from ExceptionSenderTask);
  • When new exception is caught - tries to send immediately;
  • When message sucessfully sent - files are deleted from disk;
  • Can send message to multiple recipients (multiple To)

Installation

Use NuGet package Logging.ExceptionSender

Dependencies

Usage

1. Register at MailGun.com (if needed)

If you wish to use MailGun for sending mail, you need to create account (or use existing one, if any).

Register your site at MailGun.com and write down your domain name and api key:

"sample

2. Configure/initialize in Startup.cs

Sample (minimum) configuration in config.json (aka appsettings.json):

{
    ...
    "ExceptionSender": {
        "MailgunBaseUrl": "https://api.mailgun.net/v3/", // some accounts need https://api.eu.mailgun.net/v3/
        "MailgunDomain": "example.com",
        "MailgunApiKey": "key-*************",
        "From": "[email protected]",
        "To": ["[email protected]", "[email protected]"]
    }
    ...
}

In ConfigureServices method of your Startup.cs:

services.AddMailgunExceptionSender(Configuration.GetSection("ExceptionSender"));

In Configure method of your Statup.cs:

// Enable in-memory logging
loggerFactory.AddMemory();

// Activate ExceptionSender middleware to catch ASP exceptions
app.UseExceptionSender();

logging.exceptionsender's People

Contributors

justdmitry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

logging.exceptionsender's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.