title: How To Properly Configure Ninject.Extensions.Logging.Log4Net in my MVC3 project
body: <p>I am trying to properly use Ninject to inject log4net logging into my MVC3 application.  I am using the <strong>Ninject.MVC3</strong> package, so I have the NinjectMVC3 class that automatically extends the App_Start method and contains the RegisterServices method that binds all dependencies.  I also have the <strong>Ninject.Extensions.Logging.Log4Net</strong> package, but I don't know how to use it.  I already know how to configure log4net in my web.config, but don't know how to use this extension for DI.</p>
  
  <p>I have read all the following articles/posts, but none of them seem to define how to properly setup a project for DI logging.</p>
  
  <p>At <a href="http://dotnetdarren.wordpress.com/2010/07/29/logging-in-mvc-part-4-log4net/" rel="nofollow noreferrer">http://dotnetdarren.wordpress.com/2010/07/29/logging-in-mvc-part-4-log4net/</a>, Darren
  provides a great article, but doesn't seem to deal with DI (at least I don't see it).</p>
  
  <p>At <a href="https://stackoverflow.com/questions/6781418/using-ninject-to-fill-log4net-dependency">Using Ninject to fill Log4Net Dependency</a>,
  Remo Gloor states here that the extensions should provide all that's needed for implementation, but it doesn't show the code of how to instantiate it.</p>
  
  <p>The documentation for ninject.extensions.logging at <a href="https://github.com/ninject/ninject.extensions.logging/wiki/Using" rel="nofollow noreferrer">https://github.com/ninject/ninject.extensions.logging/wiki/Using</a> is very limited at best.  I have re-read it many times, and still don't see how to use bind the injection in the NinjectMVC3 class, or concrete examples of how to call the logger from my controller class for example.</p>
  
  <p>At the most promising article, Moosaka provides some great code at <a href="https://stackoverflow.com/questions/7227628/ninject-extensions-logging-log4net-unexpected-behavior">Ninject.Extensions.Logging.Log4net unexpected behavior</a>, but when I try it, I get a compile error in the LoggerFactory at <code>ILogger logger = new Logger(type);</code> stating "Cannot access protected constructor 'Logger' here".  Also, he states to "Tuck this whole mess away into a separate class library".  Does that mean as a whole separate project? </p>
  
  <p>I'm just getting lost in all the differing options and dated posts and would like any input on how to use Dependancy Injection with Ninject and Log4Net in my MVC3 project.  Also, if it matters, all of my Ninject code is in my domain project, but the logging needs done from both the domain and web project (and mocked in my unit tests).  Any help is appreciated.</p>