Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why NLog.LogManager.Configuration returns null?

In my project I got an NLog.config file but when I debug the Main method on my project NLog.LogManager.Configuration is null.

How can I make sure that the NLog.config will be found?

like image 319
Yoda Avatar asked May 20 '26 04:05

Yoda


2 Answers

In my case, I have just changed NLog.config property "Copy to output directory" = "Copy if newer" from "Do not copy".

like image 55
Rousonur Jaman Avatar answered May 22 '26 00:05

Rousonur Jaman


When there is no config loaded, NLog.LogManager.Configuration will return null.

There could be various reasons why the config is not loaded, check the troubleshooting steps for finding the reason.

like image 40
Julian Avatar answered May 22 '26 00:05

Julian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!