dotFive
dotFive

Reputation: 461

NLog: LayoutRenderer cannot be found

NLog throws an exception while trying to create logger:

var configuration = new XmlLoggingConfiguration(configurationPath);

Exception message: LayoutRenderer cannot be found: 'TargetDirectory'

Logger configuration:

<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 is presented in bin folder
D:\Internal\Logs\ folder exists on HDD but I don't think that it is the problem's root

But what?

Upvotes: 1

Views: 3063

Answers (1)

Prem Patel
Prem Patel

Reputation: 21

Change value="D:\Internal\Logs\"

to:

value="D:/Internal/Logs/"

and

fileName="${TargetDirectory}${TraceLogname}

to:

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

Upvotes: 2

Related Questions