When you use NLog in your C# project, its configuration is loaded once on the application startup. Now I want to change the configuration (targets, rules, levels) while application is running. It’s easy – just edit NLog.config file.
That’s not enough. Application should notice that changes and reapply them. This can be triggered by re-reading NLog.config again at some point, by pressing the button or calling Web API, i.e. you or your application should initiate reloading.
As for NLog, reloading is implemented by 3 lines of code.
// save all log entries
// get configuration from NLog.config
LogManager.Configuration = LogManager.Configuration.Reload();
// update loggers