>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 :-)

In c# I do this:
ILog l = log4net.LogManager.GetLogger(this.GetType());

vb.net should have a .GetType() on the "me" object as well.

Allen Lyons 
Web Application Developer
TBS Enterprise Applications


-----Original Message-----
From: Marco Herrn [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 13, 2004 11:49 AM
To: [email protected]
Subject: How to log to the same Log instance from multiple classes


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 :-)

Reply via email to