Sergey Shishkin

on agile software development

Enterprise Library: ContextItems and ExtendedProperties Fix

Yet another Enterprise Library 2.0 Logging Application Block fix here. All values that are stored in the CallContext using the EntLib’s ContextItems class are populated to the LogEntry.ExtendedProperties dictionary during the LogEntry processing in the LogWriter class. The problem is that these values are populated only after the LogEntry is considered to be logged, i.e. after all the filters are passed. So, there is no opportunity to use these values during the ShouldLog phase in a custom filter, which I consider as a design flaw. To involve CallContext items into the entries filtering, one needs to move just two lines of code from one method to another. Here is the fix:

Logging\LogWriter.cs, Line 376, Remove:

ContextItems items = new ContextItems();

Logging\LogWriter.cs, Line 237, Add:

ContextItems items = new ContextItems();

Written by Sergey Shishkin

22.09.2006 at 18:07

Posted in Uncategorized

%d bloggers like this: