In my application, I work on several thousand of document a day. I\'d like, in some cases some logs, one log by document. Then I\'d like for a specific target change the out
Try ReconfigExistingLoggers method:
var target = (FileTarget)LogManager.Configuration.FindTargetByName("logfile");
target.FileName = "${logDirectory}/file2.txt";
LogManager.ReconfigExistingLoggers();
As written in docs:
Loops through all loggers previously returned by GetLogger. and recalculates their target and filter list. Useful after modifying the configuration programmatically to ensure that all loggers have been properly configured.
EDIT:
Try use custom layout renderer: NLog config file to get configuration setting values from a web.config