Ninject.Web - ILogger Bindings

744 views
Skip to first unread message

Nathan

unread,
Nov 12, 2009, 4:06:30 PM11/12/09
to ninject
I am using the Ninject.Web library provided by Ian Davis (http://
github.com/idavis/ninject.web) and I'm having trouble with it because
the library is filled with ILogger injection points, but there is no
concrete implementation of ILogger to bind them to when I create the
kernel.

Should I just go through the code and remove the bindings or is there
something else you'd recommend instead?

Ian.F...@gmail.com

unread,
Nov 12, 2009, 5:19:43 PM11/12/09
to ninject
You need the logging extension as well I believe: http://github.com/idavis/ninject.extensions.logging

Dan Johnson

unread,
Nov 12, 2009, 5:35:33 PM11/12/09
to ninject
I have a similar issue (I think).

I get
Error activating ILoggerFactory
No matching bindings are available, and the type is not self-bindable.
Activation path:
1) Request for ILoggerFactory

Despite having:
Bind<ILoggerFactory>().To<NullLoggerFactory>();
in my module passed to the StandardKernel
(NullLoggerFactory is in Ninject core dll so no extensions.logging
needed?)

Ian.F...@gmail.com

unread,
Nov 12, 2009, 5:47:59 PM11/12/09
to ninject
You need to use the NLogModule or Log4netModule in the kernel's ctor instead.

-Ian

On Nov 12, 2009 2:35pm, Dan Johnson <d...@netfield.co.uk> wrote:
>
>
> I have a similar issue (I think).
>
>
>
> I get
>
> Error activating ILoggerFactory
>
> No matching bindings are available, and the type is not self-bindable.
>
> Activation path:
>
>  1) Request for ILoggerFactory
>
>
>
> Despite having:
>
>            Bind().To();

Dan Johnson

unread,
Nov 12, 2009, 5:55:04 PM11/12/09
to ninject
Aagh. My apologies - I'm getting v1 and v2 in a muddle.

Ian.F...@gmail.com

unread,
Nov 12, 2009, 6:02:46 PM11/12/09
to ninject
NP. I hope the info I gave helps.

Dan Johnson

unread,
Nov 13, 2009, 10:40:40 AM11/13/09
to ninject
Yes thanks.

I've cloned your logging examples into a
Ninject.Extensions.Logging.Null library
(i.e. a null logger with all isEnabled properties set to return false)
so that I can use ninject.web without adding a logging framework.

Is / was there a better way to do this (i.e. some configuration /
binding magic)
or, where's the best place to share this / submit it for comment /
mods?

Ian Davis

unread,
Nov 13, 2009, 1:35:35 PM11/13/09
to nin...@googlegroups.com
I am open to suggestions. I would like to pull out the logging, but I don't want to effect those already using it extension from v1.
--
Ian Davis
http://disassembla.net
Reply all
Reply to author
Forward
0 new messages