views:

319

answers:

1
+1  Q: 

Binsor and log4net

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?

+1  A: 

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.

Gilligan
Yes, I figured as much, but can you give an example of how to do that? For the life of me, I can't figure it out.
Karl
OH, geez. I am not sure I have only used Binsor once. I think the syntax is very similar to th facility syntax, however. I will look little attempt at work and see what I can do.
Gilligan