I am having issues with windsor castle log4net facility integration in ASP.Net MVC. I have two project with same code (sample I wrote to keep the reference and my current project). Sample project works fine but my current project doesn't work I get a null reference exception. I have an asp.net mvc 3 application with integration of castle windsor IOC. Added necessary dlls via NuGet. Here is my Code fragement:
Step 1: Logger Installer
public void Install(Castle.Windsor.IWindsorContainer container, Castle.MicroKernel.SubSystems.Configuration.IConfigurationStore store)
{
container.AddFacility<LoggingFacility>(f => f.UseLog4Net());
//container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.config"));
}
Step 2:
log4net.config
Step 3: In my AccountController(LogOn Method)..
public ILogger Logger { get; set; }
Logger.InfoFormat("User {0} has successfully signed in.", model.UserName);
In past week, I have tried everything and read 20-30 posts on this website but I still cannot get it work. May be if someone can tell me what the issue is and point me to a step-by-step tutorial, I would great be thankful.
I am not sure what am i missing. I have checked Project->Properties->Application->.Net Framework 4.0 but still doesn't work.
Note: I followed the castle windsor website tutorial http://docs.castleproject.org/Windsor.Windsor-Tutorial-Part-Five-Adding-logging-support.ashx