Where is ${basedir} located, using NLog?

Spikee picture Spikee · Feb 5, 2016 · Viewed 34.7k times · Source

Unless I'm totally missing it, I'm under the impression that the NLog documentation uses ${basedir} in its examples, without explaining what its location is supposed to be.

Where can I find information that lists all possible options with a meaningful description?

I have this configuration defined:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" throwExceptions="true">
  <targets>
    <target name="file" xsi:type="File"
                layout="${longdate} ${logger} ${message}"
                fileName="${basedir}/logs/${shortdate}.txt"
                keepFileOpen="false"
                encoding="iso-8859-2" />
  </targets>
  <rules>
    <logger name="*" minlevel="Debug" writeTo="file" />
  </rules>
</nlog>

It works as far as I can tell, but I haven't got a clue where it logs anything at.

Answer

galakt picture galakt · Feb 5, 2016

${basedir} — Directory where the application runs, aka. AppDomain.BaseDirectory

I think, you will find this manual page helpful.