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

Fail to load namespace Spring Security http://www.springframework.org/security/tags -

c++ - Using Gtest how return different values in ON_CALL? -

asp.net core mvc - How important is the global.json and src folder? -