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 listenersDefaultTraceListener, TextWriterTraceListener, and EventLogTraceListenerdon't require the same type of long name. These configuration file entries are valid:
<add name="TextListener" type="System.Diagnostics. TextWriterTraceListener" initializeData= "c:\myListener.log" /> <add name="SQLListener" type="KADGen.TracingTools. SQLTraceListener, TracingTools" initializeData= "data source=(local);initial catalog=TraceOutput;integrated 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> [, <assemblyproperties>]
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( KADGen.TracingTools.Tools).AssemblyQualifiedName
It returns this code:
"KADGen.TracingTools.Tools, TracingTools, Version=22.214.171.124, 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 namesit says you should use Nothing. Fully qualified names are strings and always use the framework descriptor "null."