我正在使用一个网站项目,我从Nuget添加了Nlog,并使用了以下NLog配置:
<?xml version="1.0" encoding="utf-8" ?>
<nlog autoReload="true"
throwExceptions="true"
xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target name="logfile" xsi:type="File" fileName="log.txt" />
</targets>
<rules>
<logger name="*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
我运行了ProcessMonitor,结果显示Nlog试图在IISExpress文件夹中创建log.txt而不是我的网站项目文件夹。
C:\Program Files (x86)\IIS Express\log.txt
我该如何让NLog将我的日志文件log.txt
放在我的网站项目文件夹而不是IISExpress文件夹中?
${basedir}
计算的。时光飞逝。 - Jon Hanna