【问题标题】:NLog: LayoutRenderer cannot be foundNLog:找不到 LayoutRenderer
【发布时间】:2015-10-12 15:25:18
【问题描述】:

NLog 在尝试创建记录器时抛出异常:

var configuration = new XmlLoggingConfiguration(configurationPath);

Exception message: LayoutRenderer cannot be found: 'TargetDirectory'

记录器配置:

<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <extensions>
    <add assembly="NLog.Extended" />
  </extensions>
  <variables>
    <variable name="TargetDirectory" 
              value="D:\Internal\Logs\" />
...
  <targets>
    <target name="TraceLog"
            xsi:type="File"
            fileName="${TargetDirectory}${TraceLogname}"
...
</nlog>

NLog.Extended.dll 出现在bin 文件夹中
D:\Internal\Logs\ 文件夹存在于 HDD 上,但我认为这不是问题的根源

但是什么?

【问题讨论】:

    标签: nlog


    【解决方案1】:

    更改value="D:\Internal\Logs\"

    到:

    value="D:/Internal/Logs/"

    fileName="${TargetDirectory}${TraceLogname}

    到:

    fileName="${TargetDirectory}/${TraceLogname}

    【讨论】:

      猜你喜欢
      • 2017-12-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-12
      相关资源
      最近更新 更多