Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to specify a path for NLog config file?

Because I use Azure DevOps my deployment and I have 3 environments (dev, staging, prod). Each of them use really specific NLog definition.

I would like to create 3 NLog file Nlog.dev.config, NLog.staging.config and NLog.prod.config and tell NLog which one to use. I can also simply save Nlog in a folder that is not overridden by the deployment tool. Whatever, I need to specify the path of my config file.

https://github.com/nlog/NLog/wiki/Configuration-file

like image 498
Bastien Vandamme Avatar asked Dec 30 '25 03:12

Bastien Vandamme


1 Answers

Loading NLog configuration from file NLog will automatically scan for configuration files, but sometimes the platform requires explicit configuration loading like this:

NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration("nlog.config");

Thank you Joe

like image 195
Bastien Vandamme Avatar answered Jan 02 '26 19:01

Bastien Vandamme