What's in a Name?

Trace listeners defined in the app.config file require a fully qualified name. This can be a little confusing because the framework listeners—DefaultTraceListener, TextWriterTraceListener, and EventLogTraceListener—don't require the same type of long name. These configuration file entries are valid:

<add name="TextListener" 
      "c:\myListener.log" />
<add name="SQLListener" 
      SQLTraceListener, TracingTools"  
      "data source=(local);initial 
      security=SSPI" />

How do you determine the fully qualified name for your custom listener? The help file gives it in complete Backus-Naur Form. Here's a more readable form of the common elements:

<namespace>.<type>, <assemblyname> [, 

Version, Culture, and PublicKeyToken are the common assembly properties. These properties are important in loading assemblies that use a strong name, and are not used in the previous sample because the assembly doesn't have a strong name.

You can determine the fully qualified name of in the Immediate window using this code:

? gettype(

It returns this code:

TracingTools, Version=, 
Culture=neutral, PublicKeyToken=null"

PublicKeyToken is null, so you don't need to specify the version or culture in app.config. Visual Basic users should note that the documentation is wrong for strong names—it says you should use Nothing. Fully qualified names are strings and always use the framework descriptor "null."