Current .Net Version: 2.0.50727
Home
Articles
C# & .Net Framework Reference
Practice C# Online
XML Web Services
RSS Feeds
Code Snippets
T-SQL Scripts
Videos
Valuable Links
Contact Us
Mike's C#, VS.NET and SQL Blog




ROR XML Info.
Incorrect TraceListener .Net Framework SDK v1.0 Information
Author: Michael G.     Last Updated:2/15/2004 12:00:00 AM
Category(ies): .Net Framework All
Description: The .Net Framework SDK v1.0 contains incorrect TraceListener information.
  Add & View Comments About this Article

The .Net Framework SDK Documentation v1.0 contains incorrect information on how to add Trace Listeners to your application via the application configuration file (assemblyname.exe.config).

Specifically, the <listeners> Element page shows an example on how to add Trace Listeners, and the problem lies in the type attribute syntax.

.Net Framework SDK v1.0 - <listeners> Element Example: <configuration> <system.diagnostics> <trace autoflush="true" indentsize="0"> <listeners> <add name="MyListener" type="System.Diagnostics.TextWriterTraceListener,System" initializedata="MyListener.log"/> <add name="MyEventListener" type="System.Diagnostics.EventLogTraceListener,System" initializedata="MyConfigEventLog"/> </listeners> </trace> </system.diagnostics> </configuration>
.Net Framework SDK v.1.1 - <listeners> Element Example: <configuration> <system.diagnostics> <trace autoflush="true" indentsize="0"> <listeners> <add name="MyListener" type="System.Diagnostics.TextWriterTraceListener, Version, Culture, PublicKeyToken" initializedata="MyListener.log"/> <add name="MyEventListener" type="System.Diagnostics.EventLogTraceListener, Version, Culture, PublicKeyToken" initializedata="MyConfigEventLog"/> </listeners> </trace> </system.diagnostics> </configuration>
NOTE: Even though the second example is based on .Net Framework 1.1, it is still the correct syntax for applications built with .Net Framework 1.0 - it will work with both versions of the Framework.

type attribute syntax - you do not need to provide the assembly's version, culture or token. You can simply provide the type, so long as there's only one version, and it's not part of the GAC (Global Assembly Cache).

Comments Click Here to Add your Comment
No Comments Found.
 
COPYRIGHT/DISCLAIMER | CONTACT US