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 -

sql - MySQL query optimization using coalesce -

unity3d - Unity local avoidance in user created world -