I have gone through some other posts in this forum that are related to Ninject and Log4net, but none seemed to address the issue (or resolve it).
Code looks like
IKernel kernel = new StandardKernel(new NinjectSettings() { LoadExtensions = true });
kernel.Load(Assembly.GetExecutingAssembly());
Program pgm = new Program(kernel.Get<IFSLog>());
Exception is thrown in the last line above with message "Error activating ILog. No matching bindings are available... "
IFSLog is an interface defined in my assembly and its implementation has a dependency on the log4Net Ilog object as below
public class Log4NetLog : IFSLog {
private ILog logger;
public Log4NetLog(ILog log) {
this.logger = log;
}
...
}
The project references the Ninject.extensions.logging.log4net assembly, so my understanding is that the ILog binding should be identified from there.
Also tried the alternate way of specifying bindings manually
public class Bindings : NinjectModule {
public override void Load() {
Bind<IFSLog>().To<Log4NetLog>();
}
}
and initializing kernel as
IKernel kernel = new StandardKernel(new NinjectSettings() { LoadExtensions = false },
new INinjectModule[] {new Bindings(), new Log4NetModule()});
Still same result. Any help much appreciated, thanks in advance...