web.config already has a file watch on it from ASP.Net. If your log4net config 
is in web.config and you change web.config, the entire ASP.Net website will 
reinitialize.



If your log4net.config is in the same directory as the web.config file you can 
use something like this to initialize log4net (there's probably other ways too):



XmlConfigurator.ConfigureAndWatch(new 
FileInfo(AppDomain.CurrentDomain.SetupInformation.ApplicationBase + 
"log4net.config"));



----- Original Message ----

From: "Parrish, Ken" <[EMAIL PROTECTED]>

To: [email protected]

Sent: Thursday, July 5, 2007 3:56:11 PM

Subject: ConfigureAndWatch for a web app ...



I am attempting to use the method XmlConfigurator.ConfigureAndWatch for a web 
service application.  In the Application_Start method in Global.asax, I have 
change from:

     

   XmlConfiguration.Configure();

     

   To:

     

   XmlConfigurator.ConfigureAndWatch(“web.config”);

     

   However, log4net appears not to configure properly.  I suspect that log4net 
cannot find ‘web.config’ since the current directory for the executing 
application context is not the root directory of my web site.

     

   How can I indicate to log4net where ‘web.config’ is located without having 
to specify an absolute path?  Is there a way in Global.asax to ‘fetch’ the root 
directory of my web application so that I can supply it to the 
ConfigureAndWatch method?

     

   Thank you,

     

   Ken Parrish

   Bedford, MA

Reply via email to