A trace filter is a nice thing, it can decide whether to log a message or not.
Two filters exist in the framework, and they are covered widely on MSDN.
Writing a custom filter is quite easy.
Just derive your filter class from TraceFilter
, override the one and only method ShouldTrace
(which returns bool) and there you go.
Now the only thing left is to add the filter to the listener in your applications config file.
Oh yes, here are the files: