简体   繁体   中英

Disabling .info logging in nLog

In my .net application I am using nLog for logging ,now I want to disable .info logging (ie .error and .fatal log feature sholud be enabled) is there any option exists for that? plz help

You can set up the minimum log levels in the rules section of the nlog config in your app.config file. So for example, the following will configure nlog so that only warnings and above (which includes errors and fatals, but not info or trace) will be logged to a target named 'file':

<nlog>
  <rules>
    <logger name="*" minlevel="Warn" writeTo="file" />
  </rules>
</nlog>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM