Question

I'm using Castle Windsor and Binsor to use dependency injection in my application. I'm no expert at either one. Usually I can figure out how to bend Windsor to my will, but I find Binsor much harder, especially since I haven't found any decent documentation for it.

I'm trying to create a binsor configuration file where I use logging. I configure logging using the following binsor code:

facility LoggingFacility:
  loggingApi = LoggerImplementation.Log4net
  configFile = "ParasiteLogConf.log4net"

This works great, all components that are registered with the container and that takes an ILogger object as an argument to the constructor will receive the correct ILogger instance.

However, what I want to do now is to use another logger for one specific component. I want that component to log to a file, whereas the other components should only log to screen. How would I go about expressing that using Binsor code?

Was it helpful?

Solution

Aynede@Rahien is your friend here. He has many blog posts on using and configuring Binsor.

For the special logger, you need to add it as a component and then explicitly set the logger property of the dependent component to the id of the special logger component.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top