I normally use a static variable if I want to use the same configuration across classes.  That way I only configure it once.

The way that I use to call the configuration so that it is not hard coded, but is to be used throughout the assembly is:

log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod.DeclaringType);

HTH

David Williams

Marco Herrn <[EMAIL PROTECTED]> wrote on 10/13/2004 11:49:28 AM:

> Hi,
>
> I don't know if the subject makes really clear what I want.
> I want to configure log4net only once, usually this way:
>
> this.log= LogManager.GetLogger(typeof(MyClass));        
> log4net.Config.DOMConfigurator.Configure(new
> System.IO.FileInfo("log4net.xml"));
>
> Now I want to log from other classes too, without reconfiguring the
> Logger. So all other classes should be able to access log4net by only
> calling the first line above. Of course, they should use the same
> configuration.
> So, how can this be done?
>
>
> And, btw., do you know way of getting the classname of the current class
> dynamically instead of using 'typeof(MyClass)'? I know this isn't
> log4net specific, but maybe you can help me here too :-)


IMPORTANT: E-mails from this company normally contain confidential material for the sole use of the intended recipient. The use, distribution, transmittal or re-transmittal by an unintended recipient of any communication is prohibited without our express approval in writing or by e-mail. If you are not the intended recipient please contact the sender and delete all copies. All e-mails sent to or from Strohl Systems are to be used for our business purposes only. E-mails sent from or to the company are subject to review by the company.

Reply via email to