gua*_*ome 27 asp.net webforms nlog
我正在使用一个网站项目,我从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>
Run Code Online (Sandbox Code Playgroud)
我运行了ProcessMonitor,它显示Nlog正在尝试在IISExpress文件夹而不是我的网站项目文件夹中创建log.txt.
C:\ Program Files(x86)\ IIS Express\log.txt
如何让NLog将我的日志文件log.txt放在我的网站项目文件夹而不是IISExpress文件夹中?
gua*_*ome 49
我们想通了.
添加${basedir}到文件名
filename="${basedir}/log.txt"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8254 次 |
| 最近记录: |