asp.net - how to disable the particular log, dynamically in Nlog using C#? -


i tried disable particular log in nlog config , added

logger name="*" minlevel="trace" maxlevel="trace" writeto="t" enabled="false"

is working fine. need programmatically in c#.

you need this:

        // lookup rule in nlog config         var rule = logmanager             .configuration             .loggingrules                             .firstordefault(_ => _.loggernamepattern == "*");          // disable rule         if (rule != null)                         rule.disableloggingforlevel(loglevel.trace); 

Comments

Popular posts from this blog

javascript - How to process users in one specific order using map o each function? -

java - Two interface have same method name with different return type -

javascript - Linking from page A to a specific iframe on page B -