Skip to content

Integrates into log4net and reports all logged exceptions to Coderr

License

Notifications You must be signed in to change notification settings

aTiKhan/Coderr.Client.Log4Net

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

log4net integration library

VSTS NuGet

This library will report all exceptions that you log using log4net.

Example

try
{
    SomeBusinessCode();
}
catch (Exception ex)
{
    _logger.Debug("Failed to do business", ex);
}

Result

Will result in an exception in codeRR with the following (extra) context information:

Installation

  1. Download and install the codeRR Community Server or create an account at coderrapp.com
  2. Install this client library (using nuget coderr.client.log4net)
  3. Configure the credentials from your codeRR account in your Program.cs.
  4. Add the following line to activate this library: Err.Configuration.CatchLog4NetExceptions();

Full example:

namespace Coderr.Client.Log4net.Demo
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            XmlConfigurator.Configure(new FileInfo("log4net.config"));

			//when using our live service.
            var url = new Uri("https://report.coderr.io/");
            Err.Configuration.Credentials(url,
                "yourAppKey",
                "yourSharedSecret");

            // injects into the log4net pipeline
            Err.Configuration.CatchLog4NetExceptions();

			
			//try the config
            var log = LogManager.GetLogger(typeof(Program));
            log.Info("Hello word");

            var service = new SomeService();
            service.DoSomeStuff();

            Console.WriteLine("Exception have been logged.");
            Console.ReadLine();
        }
    }
}

Requirements

You need to either install Coderr Community Server or use Coderr Live.

More information

About

Integrates into log4net and reports all logged exceptions to Coderr

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%