Sorry, the line became more complicated than necessary (that's what I get for cut&pasting shamelessly from the documentation).

 

It should say:

 

XmlConfigurator.Configure(new FileInfo("logging.config"));

 


From: Göran Roseen [mailto:[EMAIL PROTECTED]]
Sent: den 7 november 2005 15:38
To: 'Log4NET User'
Subject: RE: What do I need to do to get rid of this error? Please help

 

>Ramaa Davanagere wrote:

>"I can't use the config file because this component is being used as an interop component and all the VB components (20+) use this interop component for Error >tracing and logging. Interops don't handle the config files very well. Hence I am using an xml file (as my config file, log4netconfig.xml) and I load this and set my >rollingfile appender properties."

 

I understand that you don't like the App.Config file.

But you don't have to put your log4net configuration in the Application Config file!

 

If you put you log4net configuration (using the "normal" log4net configuration syntax) in a separate file, e.g. "logging.config", you can then configure your application with one simple line in your main program:

 

XmlConfigurator.Configure(new FileInfo(ConfigurationSettings.AppSettings["logging.config"]));

 

If you make sure you don't use ConfigureAndWatch, there should be absolutely no difference between log4net reading this file, and your code that is reading your specially-formatted file. Besides of course the upside that you don't have to reinvent the whole configuration code...

 

/Göran

 

 

Reply via email to