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
Post a Comment