C# DLL - Loading seperate app.config file for Common.Logging (Log4Net)

291 Views Asked by At

I am busy working on a C# library and I would like to make use of the Common.Logging with Log4Net, however, it looks for in the host applications app.config file for respective libraries settings.

Is there anyway of telling Common.Logging to look at a different config file?

1

There are 1 best solutions below

0
On BEST ANSWER

you could execute this code once on applicatin startup:

XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net.config"));

you may add this to AssemblyInfo.cs with the same result.

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]