Reload function

1 message Options
Embed this post
Permalink
Erik

Reload function

Reply Threaded More More options
Print post
Permalink
I have NLog setup using the app.config configuration.

However, if I add this code let's say after a button click somewhere

            LogManager.Configuration.LoggingRules.Clear();
            var loggingRule = new LoggingRule("Domain.*", LogLevel.Trace, logViewerTarget);
            LogManager.Configuration.LoggingRules.Add(loggingRule);
            LogManager.Configuration.Reload();

I expect that nothing would be logged anymore, however it just keeps on logging.

Basically I wanted to change the loggingrules during the application session and I figured to clear the logging rules, add some new and then just Reload. However it seems to remember all of my previous loggingrules. I'm I taking this in the right direction here?