Nlog: Use layout renderers for NLog internal logging

Created on 25 Jan 2019  路  3Comments  路  Source: NLog/NLog

NLog version: 4.5.11
Platform: . .Net 4.6.1
Current NLog config XML

<nlog autoReload="false" xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
internalLogFile ="${tempdir}/NLog/NlogInternal.log" internalLogLevel="Warn">

This snippet worked with NLog 2.0.1.2: It created the internal log file in the file systems temp dir:
_%TEMP%\NLog\NlogInternal.log_

With NLog 4.5.11 the internal NLog file is created as a subfolder in the application directory:
_AppDir\${tempdir}\NLog\NLogInternal.log_

It seems that layout renderers are no longer working for the internal NLog configuration. I also tried _${environment:TMP}_ but did not work as well

question

All 3 comments

layout renderers aren't supported for internal logging, as the internal logging should be as stable as possible.

if you need more stuff, use InternalLogger.LogWriter

#3031 makes %TMP%\NLog\NLogInternal.log work with NLog 4.6. And if #3092 is merged then ${tempdir} will also work.

OK, that's also fine too me. Thanks snakefoot!

Resolved in NLog 4.6

Was this page helpful?
0 / 5 - 0 ratings

Related issues

geedsen picture geedsen  路  3Comments

Jerefeny picture Jerefeny  路  3Comments

imanushin picture imanushin  路  3Comments

vasumsit picture vasumsit  路  3Comments

MaximRouiller picture MaximRouiller  路  3Comments