-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to inject ILogger into MvcApplication (asp.net mvc) #14
Comments
I'm not familiar with how MvcApplication gets activated, but I don't think -Ian On Tue, Sep 18, 2012 at 8:43 PM, Matt Phillips notifications@github.comwrote:
|
I'm also using the Ninject.Mvc3 package. That package creates the following class.
Even with the ninject.extensions.logging.log4net package installed that doesn't change this class. So #1 I have no idea how it's hooking up the logging internally, #2 I don't know if there's even a way to alter it because it happens behind the scenes |
I ended up finding a stackoverflow question that answered mine. I don't have the link for it, but I think it just has something to do with how the MVC3 plugin automagically adds the ninject module after the application is started. I was able to solve this by using |
I'm using ninject.extensions.logging and ninject.extensions.log4net. I can confirm I have logging setup properly because all my controllers/other classes in the project are able to log. But for some reason I can't get ninject to inject an ILogger into the MvcApplication class in the global asax file. Here's the code
as you can see the ILogger is being injected with the
[Inject]
attribute as a property. But I always get a null reference when I try and use it from inside this class.The text was updated successfully, but these errors were encountered: