1

I develop a web application using NLog logger. I want to have different logger configurations for the testing environment and the production environment

Is there a best practice as to how to set the configuration for the NLog logger using existing Xml file?

I want to have a configurable logger both in my test environment and in the production development.

In production environment I make a call in the highest point of the first method fired to

LogManager.Configuration = new XmlLoggingConfiguration(productionPath);

In my test environment , I execute this in the assembly initialize methods:

LogManager.Configuration = new XmlLoggingConfiguration(testingPath);

Is there a better way to configure my logger dynamically somehow?

Julian
  • 33,915
  • 22
  • 119
  • 174
  • this question does not seem to be related to [tag:unit-testing], IMO tag should be removed – Kritner May 23 '16 at 11:20
  • I think it is, because the main purpose of this question ia to allow different configuration for testing –  May 23 '16 at 11:22

0 Answers0