You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the current result?
No matter what is the order of targets in FallbackGroupTarget, fileFallback is configured as first, therefore it's not working as expected.
appsettings.json Copy To Ouptut Directory is set to "Copy always".
What is the expected result?
Configuration should respect order of the targets in FallbackGroupTarget in order to work properly.
Did you checked the Internal log?
Yes, I checked it at the Debug level. No errors were provided there.
Please post full exception details (message, stacktrace, inner exceptions)
From Logger.Factory -> ConfigurationChanged = {Method = Internal Error evaluating expression}
Are there any work arrounds? Partially yes
Based on provided example, if you change the name of fileFallback to eg. fileTest, it's working as expected. But right now if you switch order of those two targets, filePrimary is configured as the first one.
Is there a version in which it did worked?
Only with configuration from xml config file.
Can you help us by writing an unit test?
Based on provided config example.
Yes that comes as a hidden surprise for many, that json-dictionaries in appsettings.json actually are sorted string-arrays.
And in the sorted-string-array then fileFallback comes before filePrimary.
If you changed the target-names to 1stFile and 2ndFile then you would get the expected behavior.
So the ordered behavior from xml-config is not available with json-config, because of how Microsoft-Extension-Configuration have implemented json-dictionary.
Type : Bug
NLog version: 4.7.13
NLog.Extensions.Logging version: 1.7.4
NLog.Web.AspNetCore version: not used
Platform: Net 5.0 (Console App)
Current NLog config json
What is the current result?
No matter what is the order of targets in FallbackGroupTarget, fileFallback is configured as first, therefore it's not working as expected.
appsettings.json Copy To Ouptut Directory is set to "Copy always".
What is the expected result?
Configuration should respect order of the targets in FallbackGroupTarget in order to work properly.
Did you checked the Internal log?
Yes, I checked it at the Debug level. No errors were provided there.
Please post full exception details (message, stacktrace, inner exceptions)
From Logger.Factory -> ConfigurationChanged = {Method = Internal Error evaluating expression}
Are there any work arrounds? Partially yes
Based on provided example, if you change the name of fileFallback to eg. fileTest, it's working as expected. But right now if you switch order of those two targets, filePrimary is configured as the first one.
Is there a version in which it did worked?
Only with configuration from xml config file.
Can you help us by writing an unit test?
Based on provided config example.
The text was updated successfully, but these errors were encountered: