Hi Ken,

I'm not using container.Resolve.  I'm using the built in logging
facility in Windsor.  So in my container initialisation I have
something like:

container.AddFacility("logging",  new LoggingFacility
(LoggerImplementation.Log4net));

And then in my consuming classed, I just have:

public ILogger Logger

which windsor injects into.

This is working fine, but as far as I can see I have no control over
which *named* logger this is using.

Thanks,

S

On Oct 16, 11:20 am, Ken Egozi <[email protected]> wrote:
> do not contaier.Resolve<ILogger>().the whole idea is to have windsor deal
> with it - by having a component dependent on ILogger, and have Windsor
> resolve it.
>
> Say:
>
> namespace A
> {
>    public class B
>    {
>       ILogger logger;
>       public B(ILogger logger) { this.logger = logger };
>    }
>
> }
>
> Assuming you Resolve<A.B>()  (or otherwise have B as a dependency on
> somehting else), the logger instance will have the name A.B
>
> if you *have* to get hold of a logger instance directly (say on the
> application's entry point), you should resolve the ILoggerFactory, and have
> it create the proper named instance:
>
> var logger = container.Resolve<ILoggerFactory>().Create(typeof(A.B));
>
> I have a couple of blog posts on that exact topic, awaiting to be finalized
> and published (no time though)
>
> On Fri, Oct 16, 2009 at 9:51 AM, Sosh <[email protected]> wrote:
>
> > Hi,
>
> > I've set up the Windsor logging facility, and have it working with
> > log4net.  However, I can't figure out how to specify which named
> > logger the messages should go to - how do I do this? (At the moment
> > they seem to just go to root)
>
> > Thanks,
>
> > S
>
> --
> Ken 
> Egozi.http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.idcc.co.il-
>  הכנס הקהילתי הראשון למפתחי דוטנט - בואו בהמוניכם
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to