Mr. VanderKolk & Mr. Grabowski,

 

Thanks for the pointers, this is very helpful.  In a subsequent posting
to this list, Mr. Grabowski correctly pointed out what I discovered
after posting my original note, which is that ASP.NET performs file
watching and reload on the web.config file for a web site or web service
by default.  As such, it is not necessary to explicitly specify
ConfigureAndWatch for log4net for an ASP.NET web site/service (at least
for my application).

 

However, there are other cases and other applications where  determining
the base directory of an ASP.NET web application will be quite useful.

 

Thank you both for responding.

 

Ken Parrish

Gomez, Inc.

Bedford, Inc.

 

________________________________

From: Vanderkolk, John [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 05, 2007 4:42 PM
To: Log4NET User
Subject: RE: ConfigureAndWatch for a web app ...

 

Try using AppDomain.CurrentDomain.BaseDirectory. If that doesn't work
you can always specify "ups" in a relative path. For example, if you
discover your execution context is "...../WebService/MyApp/MyPage"
(online or running on your local directories) and the config file you
want is in ".../WebService" then the relative path would be
"..\\..\\web.config" The "..\" signifies one level up.

 

John VanderKolk 

 

 

________________________________

From: Parrish, Ken [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 05, 2007 3:56 PM
To: [email protected]
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


The contents of this e-mail are intended for the named addressee only.
It contains information that may be confidential. Unless you are the
named addressee or an authorized designee, you may not copy or use it,
or disclose it to anyone else. If you received it in error please notify
us immediately and then destroy it.

Reply via email to