By default Nlog logs to default application folder
<target xsi:type="File" name="f"
fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}
${exception:message=tostring}" />
Currently my application is in C directory and I want Nlog to log to D directory in specific folder. I read about
fileName="${tempdir:folder=myapptmp}/sample.log"
and
${specialfolder:dir=String:file=String:folder=Enum}
Special folder it seems logs into MyDocuments, Pictures. So not much useful. Tempdir I am not sure about. Has anybody done this earlier or has any idea about it
My Nlog config
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!-- add your targets here -->
<target name="File" xsi:type="File"
fileName="D:\Sushil\DwebLogging\log-${date:format=yyyy-MM-dd}.log"
layout="${longdate} ${uppercase:${level}} ${message} ${exception:
format=tostring}" />
<rules>
<logger name="*" minlevel="Trace" writeTo="File" />
</rules>
</nlog>