When starting a Windows service with the permissions of "NT AUTHORITY \ NETWORK SERVICE", I have a strange problem with NLog: it just doesnβt write anything to the file if the file name contains periods.
I run the Windows service on my WinServer 2008 R2 standard with the .NET Framework 3.5 SP1 enabled, NLog.config looks like this:
<targets> <target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.txt" encoding="utf-8" concurrentWrites="true" keepFileOpen="false" layout="${longdate} ${uppercase:${level}} ${message}"/> </targets> <rules> <logger name="*" minlevel="Trace" writeTo="f" /> </rules>
After some searching and experimenting with the configuration, I came up with a workaround, not including the file extension in fileName , and it worked fine, which solves the problem, but does not look like a decent solution.
And what makes the problem more like some kind of weird magic for me is that I was able to solve the problem with the log file extension in the configuration of my second Windows service (which runs on the same computer with the same names) by simply changing the information about assembly in design options.
Any ideas?
source share