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 Dominick Cosgrove <Do...@gartmore.com> on 2007/08/16 10:53:26 UTC

Using XmlConfigurator.ConfigureAndWatch to watch for Config changes

I have a ASP .Net 1.1 app which I am using log4net ver 1.2.10.0 with.

I am trying to use the log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(logfile)); method in the Application_Start Method of the Global.asax.cs, but get the following error:
Method not found: Void log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: Void log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo).

Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


Stack Trace:

[MissingMethodException: Method not found: Void log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo).]
   Scratch.Global.Application_Start(Object sender, EventArgs e) +0


If I use the log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(logfile)); everything works fine.

I have also tried using the [assembly:log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config", Watch=true)] attrribute in the AssemblyInfo.cs. This does not seem to load the configuration as log.IsDebugEnabled evaluates to false when I use this method of loading the configuration file.

I would ideally like to get the configuration file watched so that if we need to enable logging we do not need to restart the application.

Many thanks in advance

Dominick

To view our disclaimer see http://epolicy.gartmore.com

Gartmore Investment Management Limited (GIM), Gartmore Investment Limited (GIL) and Gartmore Fund Managers Limited (GFM) are all registered in England and Wales (nos 953703, 1508030 and 1137353). The registered address of GIM, GIL and GFM is Gartmore House, 8 Fenchurch Place, London, EC3M 4PB. Gartmore Global Partners (GGP) is a general partnership registered in Delaware, USA, EIN 56-1903611. The registered office of GGP is One International Place, Fort Hill Square, Boston, Massachusetts 02110, USA.   GIL, GFM and GGP are authorised and regulated by the Financial Services Authority under the references 119236 (GIL), 122610 (GFM) and 172616 (GGP). See www.fsa.gov.uk/register for more details. GGP is also a SEC registered investment advisor. 


RE: Using XmlConfigurator.ConfigureAndWatch to watch for Config changes

Posted by Dean Fiala <df...@celadonlabs.com>.
Are you sure have the right version of log4Net referenced.  I'm using this
code with no problem in 1.1 and 2.0...
 
XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(ConfigFile));

You might want to try rebuilding your project, could be something out of
whack in the assembly loading.

  _____  

From: Dominick Cosgrove [mailto:Dominick.Cosgrove@gartmore.com] 
Sent: Thursday, August 16, 2007 4:53 AM
To: log4net-user@logging.apache.org
Subject: Using XmlConfigurator.ConfigureAndWatch to watch for Config changes



I have a ASP .Net 1.1 app which I am using log4net ver 1.2.10.0 with. 

 

I am trying to use the log4net.Config.XmlConfigurator.ConfigureAndWatch(new
System.IO.FileInfo(logfile)); method in the Application_Start Method of the
Global.asax.cs, but get the following error:

Method not found: Void
log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo). 

Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code. 

Exception Details: System.MissingMethodException: Method not found: Void
log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo).

Source Error: 


An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below. 


Stack Trace: 


 

[MissingMethodException: Method not found: Void
log4net.Config.XmlConfigurator.ConfigureAndWatch(System.IO.FileInfo).]

   Scratch.Global.Application_Start(Object sender, EventArgs e) +0

 

If I use the log4net.Config.XmlConfigurator.Configure(new
System.IO.FileInfo(logfile)); everything works fine. 

 

I have also tried using the
[assembly:log4net.Config.XmlConfigurator(ConfigFile="Log4Net.config",
Watch=true)] attrribute in the AssemblyInfo.cs. This does not seem to load
the configuration as log.IsDebugEnabled evaluates to false when I use this
method of loading the configuration file.

 

I would ideally like to get the configuration file watched so that if we
need to enable logging we do not need to restart the application. 

 

Many thanks in advance

 

Dominick

To view our disclaimer see http://epolicy.gartmore.com

 

Gartmore Investment Management Limited (GIM), Gartmore Investment Limited
(GIL) and Gartmore Fund Managers Limited (GFM) are all registered in England
and Wales (nos 953703, 1508030 and 1137353). The registered address of GIM,
GIL and GFM is Gartmore House, 8 Fenchurch Place, London, EC3M 4PB. Gartmore
Global Partners (GGP) is a general partnership registered in Delaware, USA,
EIN 56-1903611. The registered office of GGP is One International Place,
Fort Hill Square, Boston, Massachusetts 02110, USA. GIL, GFM and GGP are
authorised and regulated by the Financial Services Authority under the
references 119236 (GIL), 122610 (GFM) and 172616 (GGP). See
www.fsa.gov.uk/register for more details. GGP is also a SEC registered
investment advisor.