【发布时间】:2021-10-12 08:02:01
【问题描述】:
我在使用此配置记录其内部日志时遇到了 NLog 问题
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
throwExceptions="true"
internalLogFile="${basedir}/App_Data/NLog.log"
internalLogLevel="Trace">
<targets>
<target name="debug"
xsi:type="File"
fileName="${basedir}/App_Data/Site.log" />
</targets>
<rules>
<logger name="*"
writeTo="debug" />
</rules>
</nlog>
目标“debug”运行良好,但 internalLogFile 仅在我将其设置为“D:/NLog.log”示例时才有效。
知道为什么会这样吗?
【问题讨论】:
-
注意;默认路径是安装 IISExpress 的位置。如果您指定:InternalLogFile="nLogError.txt"。然后(至少在我的 PC 上)它会尝试写入“C:\Program Files (x86)\IIS Express\nlogExceptions.txt”。可能存在权限问题。
标签: asp.net-mvc nlog