log4net integration

The log4net library injects codeRR into the logging pipeline of log4net. Each time you log something and include an exception it will be reported to codeRR. This is by far the easiest way to use the power of codeRR in legacy applications (which use log4net).

Setup

You need to have installed the codeRR server somewhere and created an application in it. Once you've done that you'll have a appKey and a sharedSecret which you can configure below.

Add the following code somewhere before the first logger is retrieved.

var url = new Uri("http://yourServer/coderr/");
Err.Configuration.Credentials(url, "yourAppKey", "yourSharedSecret");
Err.Configuration.CatchLog4NetExceptions();

That's it.

Usage

If you have code like this:

try
{
	methodThatWillThrowAnException();
}
catch (Exception ex)
{
	_logger.Debug("Failed doing some crazy stuff.", ex);
}

.. the exception will be picked up in codeRR.

As a bonus you will also see information about the log entry in codeRR:

Links

Edit page at GitHub Create a documentation ticket Ask a question This page is generated using the open source project MarkdownWeb.