When a NLog.config has an absolute path, all is working nice:
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
internalLogLevel="Info"
internalLogFile="F:\ProgramData\MyApp\myfolder\nlog.txt">
if I try to use a specialfolder variable, it fails to work:
internalLogFile="${specialfolder:folder=CommonApplicationData}\MyApp\myfolder\nlog.txt">
What NLog.config path should I use to make NLog use the ProgramData folder without using an absolute path?
I use NLog v. 2.0 on Windows 7
You can't use layout renderers ${...} in the internalLogFile property. They are for target's layout only:
<target layout="${...}" />
Try to use relative path like "..\myfolder\nlog.txt"
Based on NLog Special folders:
fileName="${specialfolder:folder=ApplicationData}/Program/file.txt"
May do the trick
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With