Ninject 2, Logging and WebForms

The officially released Ninject 2 no longer includes a link to WebForms-specific IoC features for WebForms, MasterPages, etc. Now it is split into plugins / extensions; in this case, the extension is http://github.com/idavis/ninject.web . My problem, however, is that there is a dependency on log4net (or NLog), and I cannot find documentation on how to configure it to integrate with my current log4net configuration or delete it altogether (i.e. set logging to null so that I did not. Perhaps there are two log4net configurations).

http://markmail.org/message/7iv7nltanz6ve4ga#query:Error%20activating%20ILoggerFactory%20ninject.web+page:1+mid:6o4q6ee2js2k4gfp+state:results refers to others with the same problem, but again, there is no real documentation about what to do with her. I looked at the source for all this and should be missing something obvious.

Can someone point me in the right direction to best deal with this, so I can still easily integrate Ninject with WebForms but not have extraneous logging services? Or don't worry about something like Global.asax:

    protected override IKernel CreateKernel()
    {
        IKernel kernel =
        new StandardKernel(new SomeMyModule(), new Log4netModule());
        return kernel;
    }

I am currently running my log4net configuration in global.asax via

 private readonly static ILog Log = LogManager.GetLogger(typeof(Global));:
+3
source share
1 answer

Ninject.Web ILogger, .

Ninject.Extensions.Logging, ILoggerFactory, null .

, log4net, Ninject.Extensions.Logging ninject.org Ninject.Extensions.Logging.Log4net . Ninject 2.0.

Ninject.Web , :

  • ILogger 5 ,
+3

Source: https://habr.com/ru/post/1734635/


All Articles