Rich,

There is a one-to-one mapping between domains (which are just names) and
repositories. However domains can also be aliased which means that multiple
domains may point to the same repository.

Nicko

> -----Original Message-----
> From: Denis, Rich [mailto:[EMAIL PROTECTED] 
> Sent: 07 June 2004 04:59
> To: Log4NET User
> Subject: RE: Logger Repository?
> 
> Nicko,
>       Getting back to a question that I had long ago.... 
> Concerning Repositories and "Domains", is there only one 
> repository per domain?  Your email says if I want to create a 
> repository I add a new domain attribute.
> This leads me to believe that there is a one to one mapping 
> between the two.
> Is this true?
> 
> Thanks
> Rich
> 
> -----Original Message-----
> From: Nicko Cadell [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 01, 2004 5:39 AM
> To: 'Log4NET User'
> Subject: RE: Logger Repository?
> 
> Rich,
> 
> > If the loggers are hierarchical and my component and all 
> the loggers 
> > are in a defined namespace, could't I just set the <logger> 
> tag to a 
> > higher name.
> > Like com.foo to handle com.foo.component1, com.foo.database 
> etc? (this 
> > is not me trying to find a way around using a custom 
> repository just 
> > wanting to make sure I understand the capabilities of log4net).
> 
> This is absolutely what you should do. All I was saying is 
> that it is not possible to force all the loggers from a 
> component to exist under a known root. E.g. If a component 
> uses loggers like "com.foo.component1" it is easy to set the 
> configuration on the "com.foo" logger, but the component 
> could also use loggers like "some-other-logger".
> 
> 
> > Ok so now I am sold on using named repositories.  What do I 
> do next.  
> > Again from the repositories section I gather that I need to add a 
> > repository attribute into the assebly that I want to have use the 
> > repository.  I assume I can just add this to the assembly 
> info class? 
> > Or does it have to be in a particular spot in my assembly.  
> After that 
> > when I call getLogger, is there something special that I 
> have to do or 
> > is it that transparent?  Also you mentioned that the 
> repository does 
> > not need to use the app config file, but can it?
> 
> Using multiple repositories does make things more 
> complicated. For example the dom configurator cannot load 
> multiple configurations from the same file, therefore unless 
> you want to configure all the repositories the same you will 
> need multiple config files.
> 
> To specify the name for a repository in an assembly you need 
> to use the log4net.Config.DomainAttribute e.g.:
> 
> [assembly: log4net.Config.Domain("my repository name")]
> 
> You can configure this repository using a DOMConfigurator 
> attribute on the same assembly e.g.:
> 
> [assembly: log4net.Config.DOMConfigurator(ConfigFile="my 
> repository config file")]
> 
> Having said this, if you have control over the components 
> that make up your application then it is simpler to use a 
> single repository to manage your logging.
> 
> Nicko
> 

Reply via email to