Here’s how to modify log4net settings from a config file before initializing log4net. This can be useful for example if you have encrypted connection strings in App.config and have to decrypt them before passing them to log4net.
XmlElement log4NetSection = (XmlElement)ConfigurationManager.GetSection("log4net"); // Modify the xml, e.g. by adjusting the InnerXml property... log4NetSection.InnerXml = StringCrypto.DecryptTaggedString(mypwd, log4NetSection.InnerXml); XmlConfigurator.Configure(log4NetSection);
/Emil