Hi
I followed the link: https://www.c-sharpcorner.com/blogs/sample-logging-using-nlog to setup nlog in my aspnet app.
I would like to change a configuration in NLog.config to enable or disable the logging
How I can do that?
Set globalThreshold to Off
<nlog globalThreshold="Off" />
Hi neoaguil17,
If you want to reconfigure NLog programmatically , you can manipulate the rules in memory :
https://stackoverflow.com/a/43977714/5751404
http://nlog-forum.1685105.n2.nabble.com/Programmatically-Disable-Logging-td1685510.html
If you want to turn off Logging from Nlog.config , you can use use <nlog globalThreshold="Off" /> as @Gaurav shows . That is same as setting LogManager.GlobalThreshold = LogLevel.Off .
Best Regards,
Nan Yu