views:

1179

answers:

2

I would like to use Castle Windsor 2.0 as the inversion of control container for my application and log4net 1.2.10 to provide logging services. Some Google searches suggest that Windsor provides some logging facilities and that I am supposed to create a public ILogger property on the classes that Windsor is instantiating. That sounds easy enough, but what do I need to add to app.config so I will get an ILogger that uses log4net?

The examples I have seen seem to come from an older version of Castle Windsor since they reference DLLs and namespaces that are not in the distrubution I downloaded. In particular, I do not see and Castle.Facilities.* namespace that contains logging objects. Some of these seem to have been moved to Castle.Core.Logging?

Any help is appreciated.

UPDATE:

Based on the answers below and further research, here is my current understanding.

Castle Project package release 1.0 RC3 includes many different components, including the MicroKernel, Windsor, and Services projects. The log4net integration I want is from the Services project. So, if I were to download the 1.0 RC3 package, everything I need is in one nice package.

However, the 1.0 RC3 version is really old.

As of some time relatively recently, the Castle Project components are only offered separately. Since I downloaded only the Windsor 2.0, I would not see the latest and greatest version of the Services project. Furthermore, the Services project has not had an official release since 1.0 RC3. I am not sure if I can just reference the 1.0 RC3 version or need to build my own from the latest code.

+1  A: 

Here is a exaclty what you need as well I believe: http://stackoverflow.com/questions/245354/where-how-castle-windsor-sets-up-logging-facility

Ian Davis
Hi thanks for the response. I saw examples like this, but I don't have a Castle.Facilities.Logging DLL like the config file suggests. I am a bit confused. Is this a separate package?
Jeremy
Go to http://castleproject.org/castle/download.html and click on .net Framework 2.0 release: Castle-net-2.0-release-2007-9-20.zip - you wil want bin\Castle.Services.Logging.Log4netIntegration.dll and bin\Castle.Facilities.Logging.dll - that should be it
Ian Davis
Or, you can go to the build server and grab the latest one. If you're using Windsor 2.0 you won't get binding errors.
Krzysztof Koźmic
Following Krzysztof's advise, here is a zip from the server that should have all files you need: http://www.castleproject.org:8090/repository/download/bt6/405:id/castleproject-1.1-build_1204-net-3.5-release.zip
Ian Davis
+1  A: 

To use the logging facility with Castle Windsor 2.0 you have to pull the source code from the subversion repository (http://svn.castleproject.org:8080/svn/castle/tags/Windsor-2.0) and start ClickToBuild.cmd

The necessary assemblies (Castle.Facilities.Logging.dll, Castle.Services.Logging.Log4netIntegration.dll) can then be found in \build\net-3.5\release

If you do not want to pull the source and build it yourself, you can go to http://www.castleproject.org:8090/ and download the build artifact of the Windsor 2.x Release build.

Markus Dulghier