Integrated Elmah-logging in Nancy
Switch branches/tags
Nothing to show
Clone or download
creamdog Merge pull request #7 from mike-ward/master
Fixes stylesheet reference when hosting in non-root folder, Refactor to reduce repeated code, improved query string processing
Latest commit 950ddca Sep 15, 2014
Permalink
Failed to load latest commit information.
Src removing ? seemed unecessary Feb 27, 2014
packages Code cleanup Feb 25, 2014
tools initial commit Nov 19, 2012
.gitignore nuget packages Nov 19, 2012
Nancy.Elmah.sln initial commit Nov 19, 2012
README.md Update README.md Nov 19, 2012
build.bat initial commit Nov 19, 2012
build.boo updated to Nancy 0.17.1 Jun 10, 2013

README.md

Nancy.Elmah

Integrated Elmah-logging in Nancy

##Installation

Install via nuget https://nuget.org/packages/Nancy.Elmah

PM> Install-Package Nancy.Elmah

Or build from source and drop Nancy.Elmah.dll and Elmah.dll into your solution

##Configuration

####Basic logging

  • Add the following to your bootstrapper to log all uncaught exceptions with elmah.
  • Elmah will log all uncaught exceptions.
  • You can browse the Elmah error log at http://yoursite/elmah.
namespace Nancy.Elmah.Asp.Net.Example
{
    public class Bootstrapper : DefaultNancyBootstrapper
    {
        protected override void ApplicationStartup(TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            Elmahlogging.Enable(pipelines, "elmah");
        }
    }
}

####Basic logging with secured Elmah interface

  • Add the following to your bootstrapper to log all uncaught exceptions with elmah.
  • Elmah will log all uncaught exceptions.
  • If you are logged in with the claim "administrator" you can browse the Elmah error log at http://yoursite/elmah.
namespace Nancy.Elmah.Asp.Net.Example
{
    public class Bootstrapper : DefaultNancyBootstrapper
    {
        protected override void ApplicationStartup(TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            Elmahlogging.Enable(pipelines, "elmah", new []{"administrator"});
        }
    }
}

####Exception logging and select HttpStatusCode logging

  • Add the following to your bootstrapper to log all uncaught exceptions with elmah.
  • Elmah will log all uncaught exceptions and configured HttpStatusCode's
  • You can browse the Elmah error log at http://yoursite/elmah
namespace Nancy.Elmah.Asp.Net.Example
{
    public class Bootstrapper : DefaultNancyBootstrapper
    {
        protected override void ApplicationStartup(TinyIoc.TinyIoCContainer container, Nancy.Bootstrapper.IPipelines pipelines)
        {
            base.ApplicationStartup(container, pipelines);
            Elmahlogging.Enable(pipelines, "elmah", new string[0], new HttpStatusCode[] { HttpStatusCode.NotFound, HttpStatusCode.InsufficientStorage, });
        }
    }
}