Logging Rule with FinalMinLevel also supports dynamic filters#5489
Conversation
|
| finalMinLevelWithFilters = finalMinLevelWithFilters ?? new KeyValuePair<FilterResult?, IList<Filter>>[LogLevel.MaxLevel.Ordinal + 1]; | ||
| for (int i = 0; i <= LogLevel.MaxLevel.Ordinal; ++i) | ||
| { | ||
| if (i < rule.FinalMinLevel.Ordinal) |
There was a problem hiding this comment.
In other places in the codebase FinalMinLevel is either guarded for null or there are prevention to set it to null but it's default appears to be null. When testing 5.3.1 in our codebase (to update) we encountered a rule with a FinalMinLevel unset (null) that causes a null reference to be thrown here.
There was a problem hiding this comment.
Thank you for reporting this. I have been able to reproduce the NullReferenceException by creating a LoggingRule with filters but without targets. Will try get a fix out ASAP.
There was a problem hiding this comment.
@BooTeK NLog v5.3.2 has now been released - https://www.nuget.org/packages/NLog/5.3.2
Ensure that dynamic filters also applies for logging-rules with FinalMinLevel and no targets:
See also #5488