As many people using log4net I have my own log4net wrapper that centralizes all the logging through different projects, also saves some repeated references to log4net.dll in each project.
I am using this solution posted here. Together with this one to avoid having to reference log4net.dll in projects where I use my wrapper.
I got it working for a simple console application, where I know where the App.config is located and its name:
FileInfo configFileInfo = new FileInfo("App.config");
log4net.Config.XmlConfigurator.ConfigureAndWatch(configFileInfo);
I see potential problems here:
- Each project can have its own App.config.
- This file can change its name to {projectname}.config. (in release perhaps?)
- App.config file properties have options like copy, embedded, etc. (but where exactly, can it get mixed up with other App.config?)
In short:
What is the best way to access in a comfortable way the wrapper App.config wherever it is being used?