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 Sean Carlin <se...@gmail.com> on 2006/06/16 23:18:29 UTC

Log4Net machine based configuration

Hi,

I am wondering if any thought has been given to coding log4net in such a way
that the configuration settings can be on a per-machine basis within a
single .config file?  Internally, my company has created a framework that
localizes all application settings so that the production, staging,
integration and developer workstations are all running different settings.
The settings are all configured from within the main .config file for each
application.  It appears that the way that log4net is currently setup, you
would have to programmatically change database connection strings, email
addresses, etc for the different appenders depending on machine (or else
have a Log4Net.config file for each environment.

I am running log4net v1.2.10 on Microsoft .NET v2 in a website project using
the .dll version.

Regards,
Sean

Re: Log4Net machine based configuration

Posted by Sean Carlin <se...@gmail.com>.
Hi Ron,

I think your suggestion could probably work.  I'll let you know!

Regards,
Sean

On 6/21/06, Ron Grabowski <ro...@yahoo.com> wrote:
>
> Could you post what you want the log4net config file to look like?
>
> Will this work:
>
> XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(
>   AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
>   String.Format("log4net.{0}.config", Environment.MachineName))));
>
> --- Sean Carlin <se...@gmail.com> wrote:
>
> > Hi,
> >
> > I am wondering if any thought has been given to coding log4net in
> > such a way
> > that the configuration settings can be on a per-machine basis within
> > a
> > single .config file?  Internally, my company has created a framework
> > that
> > localizes all application settings so that the production, staging,
> > integration and developer workstations are all running different
> > settings.
> > The settings are all configured from within the main .config file for
> > each
> > application.  It appears that the way that log4net is currently
> > setup, you
> > would have to programmatically change database connection strings,
> > email
> > addresses, etc for the different appenders depending on machine (or
> > else
> > have a Log4Net.config file for each environment.
> >
> > I am running log4net v1.2.10 on Microsoft .NET v2 in a website
> > project using
> > the .dll version.
> >
> > Regards,
> > Sean
> >
>
>

Re: Log4Net machine based configuration

Posted by Ron Grabowski <ro...@yahoo.com>.
Could you post what you want the log4net config file to look like?

Will this work:

 XmlConfigurator.ConfigureAndWatch(new FileInfo(Path.Combine(
  AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
  String.Format("log4net.{0}.config", Environment.MachineName))));

--- Sean Carlin <se...@gmail.com> wrote:

> Hi,
> 
> I am wondering if any thought has been given to coding log4net in
> such a way
> that the configuration settings can be on a per-machine basis within
> a
> single .config file?  Internally, my company has created a framework
> that
> localizes all application settings so that the production, staging,
> integration and developer workstations are all running different
> settings.
> The settings are all configured from within the main .config file for
> each
> application.  It appears that the way that log4net is currently
> setup, you
> would have to programmatically change database connection strings,
> email
> addresses, etc for the different appenders depending on machine (or
> else
> have a Log4Net.config file for each environment.
> 
> I am running log4net v1.2.10 on Microsoft .NET v2 in a website
> project using
> the .dll version.
> 
> Regards,
> Sean
>