<p>According to its specification, NLog should try to read a configuration file at the location of NLog.dll. This does not work for me.</p>
<p> </p>
<p>Examining the code I found that in LogFactory the lines</p>
<p> </p>
<p> // get path to NLog.dll.nlog only if the assembly is not in the GAC</p>
<p> var nlogAssembly = typeof(LogFactory).Assembly;</p>
<p> if (!nlogAssembly.GlobalAssemblyCache)</p>
<p> {</p>
<p> yield return nlogAssembly.GetName().CodeBase + ".nlog";</p>
<p> }</p>
<p> </p>
<p>yield "file:///NLog.dll.nlog"</p>
<p> </p>
<p>Cutting the "file:///" part</p>
<p> </p>
<p> {</p>
<p> yield return nlogAssembly.GetName().CodeBase.Replace("file:///", "") + ".nlog";</p>
<p> }</p>
<p> </p>
<p>makes it work.</p>
Comments:
<p> </p>
<p>Examining the code I found that in LogFactory the lines</p>
<p> </p>
<p> // get path to NLog.dll.nlog only if the assembly is not in the GAC</p>
<p> var nlogAssembly = typeof(LogFactory).Assembly;</p>
<p> if (!nlogAssembly.GlobalAssemblyCache)</p>
<p> {</p>
<p> yield return nlogAssembly.GetName().CodeBase + ".nlog";</p>
<p> }</p>
<p> </p>
<p>yield "file:///NLog.dll.nlog"</p>
<p> </p>
<p>Cutting the "file:///" part</p>
<p> </p>
<p> {</p>
<p> yield return nlogAssembly.GetName().CodeBase.Replace("file:///", "") + ".nlog";</p>
<p> }</p>
<p> </p>
<p>makes it work.</p>
Comments:
Moved to https://github.com/NLog/NLog/issues/142