简体   繁体   中英

Register Castle Windsor Logging Facility

I am new to IOC and Castle Windsor. I would like to use the logging facility provided by Castle per their documentation

http://stw.castleproject.org/Windsor.Logging-Facility.ashx

I am trying to register the facility per the documentation recommendation

container.AddFacility<LoggingFacility>(f => f.LogUsing(LoggerImplementation.Log4net).WithConfig("log4net.config"));

I have referenced the Castle.Core and Castle.Facilities.Logging dll's

at compile time I get the following error

The type 'Castle.Facilities.Logging.LoggingFacility' cannot be used as type parameter 'T' in the generic type or method 'Castle.Windsor.IWindsorContainer.AddFacility<T>(System.Func<T,object>)'. 
There is no implicit reference conversion from 'Castle.Facilities.Logging.LoggingFacility' to 'Castle.MicroKernel.IFacility'. C:\Sports\app\Daedalsoft.Sports.ApplicationServices\WindsorServiceInstaller.cs

Any help would be much appreciated.

It looks like you may have a reference to Castle.MicroKernel.dll from a previous version. Castle.MicroKernel was merged into Castle.Windsor.dll, if you're using the latest version of Windsor you shouldn't have Castle.MicroKernel.dll.

Also make sure you have a reference to Castle.Services.Logging.Log4netIntegration.dll and log4net.dll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM