NLog serializing programmatic configured configuration object to an NLog.config file
I want to be able to read an NLog configuration file from disk using the XmlLoggingConfiguration object. I then make changes to that object, e.g. AddLogLevel(bl开发者_开发知识库ah). I then want to serialize that object back into the configuration file.
I can achieve all of these things with the exception of the last item. I can't seem to find a way of serializing the XmlLoggingConfiguration object back to file.
The reason I want to do this is because I wish the changes to made permanent and not reset when the app domain is reset.
Also, the changes that I make to the configuration object is not for the LogManager that is running in the performing app domain but rather for another application that I will send the configuration file to.
This make sense?
If anyone can help me out with how I get NLog to serialize an instance of XmlLoggingConfiguration (or advise me if it is not possible) then please let me know, thanks.
P.S. I have checked the homepage and wiki but some information seems to be missing as they are making the transition between communication formats for the reference material.
I decided that this was the wrong approach. The config files can be hand edited and autoreloaded by the framework and that was exactly what we needed.
精彩评论