logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Göran Roseen <go...@roseen.se>
Subject RE: What do I need to do to get rid of this error? Please help
Date Mon, 07 Nov 2005 14:37:52 GMT
>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

 

 


Mime
View raw message