2015-10-12 103 views
0

NLOG拋出一個異常,而試圖創造記錄:NLOG:LayoutRenderer無法找到

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上存在的文件夾,但我不認爲這是問題的根源

但是什麼?

回答

0

變化value="D:\Internal\Logs\"value="D:/Internal/Logs/"fileName="${TargetDirectory}${TraceLogname}fileName="${TargetDirectory}/${TraceLogname}