我希望我的日志记录进入%AllUsersProfile%文件夹(或其子文件夹...)
我正在使用NLog 1.0,看起来网站维基有漏洞,因为他们正在升级他们的2.0版本的文档.
我正在使用Win7并尝试以下方法:
<target name="file" xsi:type="File" fileName="${%AllUsersProfile%}\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
<target name="file" xsi:type="File" fileName="${%AllUsersProfile}\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
<target name="file" xsi:type="File" fileName="${AllUsersProfile}\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
<target name="file" xsi:type="File" fileName="%AllUsersProfile%\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
<target name="file" xsi:type="File" fileName="%AllUsersProfile\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
Run Code Online (Sandbox Code Playgroud)
好的,特殊文件夹可以解决问题
<target name="file" xsi:type="File" fileName="${specialfolder:folder=CommonApplicationData}\Logs\${date:format=yyyy-MM-dd_(HH)}_(pid-${processid}).htm">
Run Code Online (Sandbox Code Playgroud)