Right, with one exception. There is no default logger by default. It is
better to query whether an ILogger is available and use NullLogger.Instance
if none is registered.
-Markus
2008/12/9 Eric Hauser <[EMAIL PROTECTED]>
>
> I'm not sure I entirely understand your scenario. If you just want to
> manually inject the dependency, just do:
>
> instance.Logger = kernel.Resolve<ILogger>();
>
> That will inject the default logger.
>
>
> On Dec 9, 11:47 am, "Ken Egozi" <[EMAIL PROTECTED]> wrote:
> > assuming Log4Net you can
> > [assembly: log4net.Config.XmlConfigurator(Watch = true)]
> > logger =
> LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType)
> >
> >
> >
> > On Tue, Dec 9, 2008 at 2:41 PM, vdhant <[EMAIL PROTECTED]> wrote:
> >
> > > Hey guys
> > > Normally one would go something like the following:
> > > public ILogger Logger
> > > {
> > > get { return logger; }
> > > set { logger = value; }
> > > }
> > > By adding this property to a class, when you get the instance of that
> > > class from Windsor, it automatically sets this property with an
> > > ILogger instance. Castle knows which ILogger to create due to the
> > > settings that are in the associated configuration file.
> >
> > > I have a circumstance where I need to trigger this process manually in
> > > order to complete some of the unit tests for the changes I am dong.
> >
> > > So If I have a variable of type ILogger and want to populate it
> > > manually based on the setting in the config how would I do this. I
> > > think it has something to do with LoggingFacility but it requires me
> > > to populate the constructor with values from the config. But i
> > > shouldn't have to do this, how do I tell castle just to get it from
> > > the config.
> >
> > > Cheers
> > > Anthony
> >
> > --
> > Ken Egozi.
> http://www.kenegozi.com/bloghttp://www.delver.comhttp://www.musicglue.comhttp://www.castleproject.orghttp://www.gotfriends.co.il
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Development List" 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-devel?hl=en
-~----------~----~----~----~------~----~------~--~---