Steven Liekens 1 year ago • updated by j.verdurmen 1 year ago 4

Using variables to include config files is a really cool feature.

  • <include file="${machinename}.config"/>

But it fails when variables expand to file names that...

  • don't exist
  • the user can't access

Suggestion: add a fallback mechanism for the above error cases.

  • <include file="${machinename}.config" fallback="default.config"/>

See https://github.com/NLog/NLog/issues/1360

Alternative proposal: don't crash when the file doesn't exist.

You can use then

<include file="default.config" />
<include file="${machinename}.config" />

This is already there: <include file='included-notpresent.nlog' ignoreErrors='true' />, you can use the orderning as a fallback