I used Nlog for logging purpose in a particular DLL. The DLL is then used in another application (it is loaded dynamically using System.Reflection.Assembly.LoadFrom(path + a.dll)
). I manually placed Nlog.dll and Nlog.config files in Path folder and the application executes properly but it does not log any messages.
However, when I go ahead and place the Nlog.config file manually in application directory (\bin\debug\
) is logs messages.
Can someone let me know how to point the search location for Nlog.Config to a different directory (d:\dev
) other than \bin\debug\
.
Below is how i changed configuration of Nlog to point to Nlog.config file present in Executing Assembly's folder.
string assemblyFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
NLog.LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(assemblyFolder + "\\NLog.config", true);