You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by Shaun Lipscombe <sh...@gmsl.co.uk> on 2006/06/20 11:08:22 UTC

Where to load configuration

Hi people :-)

I have a site that creates an object that retreives data.  I have a
service that runs that goes and gets data from various sources and puts
them into files that this data retriever object then accesses. i.e. the
service and the retriever are in no way related.  However they are all
part of my solution in Visual Studio 2005.  As is my website.

I'm a bit unsure where to put my XmlConfigurator.Configure() so that all
my logging for my entire application is controlled via one file.  There
is no top level class, so the only place I can think of would be to put
the Configure() in the website itself.

Also wont both service and website operate within different AppDomains?

Am I forced to use a configuration file per component?

Any pointers appreciated :-)

Re: Where to load configuration

Posted by Shaun Lipscombe <sh...@gmsl.co.uk>.
* Ron Grabowski wrote:
> By service, do you mean a Win32 Service? Does the service continue to
> run when the website is offline?

Yes I mean a service that runs independentaly to the web site and will
continue to run even should the website be unavailable (since it will
never be intentionally offline).

What I've done is I've put a XmlConfigurator.Configure() in the
globals.asax because I want

- logging for the site, even before any objects that contain logging are
created, plus I want those objects to have access to the static
LogManager configured by the site.

- logging for ALL sites regardless of whether those sites create objects
that contain logging.

and I've put another XmlConfigurator.Configure() (using the same XML
configuration file) in the constructor for the service.  Ideally I
wanted to just have XmlConfigurator.Configure() in one place but the
scope of the LogManager is AppDomain-wide isn't it?  What problems will
there be, if any, with the way I've configured log4net?

Can it be done in any better way or is it OK like this?

Many thanks,

Shaun

Re: Where to load configuration

Posted by Ron Grabowski <ro...@yahoo.com>.
By service, do you mean a Win32 Service? Does the service continue to
run when the website is offline?

--- Shaun Lipscombe <sh...@gmsl.co.uk> wrote:

> Hi people :-)
> 
> I have a site that creates an object that retreives data.  I have a
> service that runs that goes and gets data from various sources and
> puts
> them into files that this data retriever object then accesses. i.e.
> the
> service and the retriever are in no way related.  However they are
> all
> part of my solution in Visual Studio 2005.  As is my website.
> 
> I'm a bit unsure where to put my XmlConfigurator.Configure() so that
> all
> my logging for my entire application is controlled via one file. 
> There
> is no top level class, so the only place I can think of would be to
> put
> the Configure() in the website itself.
> 
> Also wont both service and website operate within different
> AppDomains?
> 
> Am I forced to use a configuration file per component?
> 
> Any pointers appreciated :-)
>