Please tell me exact versions of the following packages you use and the full stack trace of your exception.
NLog
Common.Logging
Common.Logging.NLog
I’ve tried to install NLog support for the project using steps written in the documentation (but changed the Common.Logging.NLog20 with Common.Logging.NLog) with the following versions, and all is working fine for me.
So, I was having a really hard time getting this working.
I couldn’t get the configuration of the logging adapter to work as per the documentation, I kept getting errors when trying to declare the LogManager.Adapter.
I ended up moving my config into the web.config file and still had problems getting the project to run.
In the end, the problem was the installation of the nuget package.
I uninstalled Common.Logging.NLog and installed Common.Logging.NLog20
This seems to be a known dependency issue, people can read more about it here;
Unfortunately Common.Logging.NLog20 does not work with Common.Logging 2.2.0 (the latest stable version), because version 2.2.0 contains breaking changes . You have problems with Common.Logging.NLog package, I had problems with Common.Logging.NLog20 package.
In Hangfire I tried to claim the lowest possible dependency version (Common.Logging 2.1.2, Newtonsoft.Json 5.0.1, etc.) for easier integration into existing projects without updating dependencies (that can cause breaking changes). But tried to choose only references to those versions that allows Hangfire to work after an upgrade to the latest stable.
Currently both 2.1.2 (referenced) and 2.2.0 (latest) versions of the Common.Logging package contain different problems regarding to a version. To prevent the configuration burden, I’ll update Hangfire to claim the latest, 2.2.0 version of Common.Logging, so everyone will have the same problems :).
And I’ll check the Common.Logging 2.1.2 with Common.Logging.NLog20 once again. If it does not work, then I update the reference to Common.Logging 2.2.0 package.