Wire up log4net to Nancy
Install Log4net nuget package
Install-Package log4net
Update your bootstapper to:
public class Bootstrapper : DefaultNancyBootstrapper
{
protected override void ApplicationStartup(TinyIoCContainer container, IPipelines pipelines)
{
base.ApplicationStartup(container, pipelines);
XmlConfigurator.Configure();
}
protected override void RequestStartup(TinyIoCContainer container, IPipelines pipelines, NancyContext context)
{
base.RequestStartup(container, pipelines, context);
}
protected override void ConfigureApplicationContainer(TinyIoCContainer container)
{
base.ConfigureApplicationContainer(container);
container.Register(typeof(ILog), (c, o) => LogManager.GetLogger(typeof(Bootstrapper)));
}
}
Ensure Log4net is in your web.config configSection
This should have already been done when the package installed, but double check.
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>