I have an application consisting of a host and pluggable modules (plugins).
I want to be able to configure log4net for the host and for each of the other modules. E
Yet another way is to have multiple log4net configuration files in multiple places, load them all up in an XDocument
to effectively compose a single one, and then call XmlConfigurator.Configure(). The way I did this was to create each file following the XSD for the configuration, load all the children of each file's log4net
root node into separate XElement
instances and merge them into a new XDocument
with a root log4net
node. I'll update this answer with the code (it's not in front of me at the moment) if anyone's interested further.
Finding the files is another matter: use some sort of convention to scan for files (e.g. *.dll.log4net.config
), embed them in the assemblies, or something.
An implementation of such code can be found on:
www.kopf.com.br/kaplof/using-multiple-configuration-files-with-log4net