Home > SOA Tips > .NET Developer > Using tracing in .NET
SOA Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

.NET DEVELOPER

Using tracing in .NET


Jim Mischel
02.03.2004
Rating: -4.33- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Over the last ten years or so, programmers have been using source level debuggers and IDEs to fix mistakes in their code. Before that programmers had to add tracing statements in their code to help deduce problems. Now tracing is back in .NET. In this excerpt from InformIT, .NET Reference Guide host Jim Mischel provides an explanation of tracing in .NET.


The .NET Framework has an integrated tracing mechanism that allows you to add trace output statements to your program and then selectively enable those statements at runtime by setting values in the application's configuration file. The Framework allows you to define your own classes that collect the trace information and send it to whatever output device you choose. Two very similar classes make use of trace output:

In theory, you would use Debug output for messages that you only want to view during debugging -- that is, during program development and never in production. You would use Trace


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Platforms and Servers
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
Decision time: .NET or J2EE?
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices
Working with PDFs in a .NET environment
Displaying errors with the error provider

.NET Developer
Programming Indigo
DataSets and Web services don't mix
Security in .NET 2.0
Tracking down managed memory leaks
Handling exceptions in .NET
.NET Compact Framework graphics
The Data Access Application Block
A great .NET resource: .Net2TheMax
Delegates vs. interfaces in .NET
Project structure best practices

Microsoft .NET Web services
How do I balance throughput requirements and interoperability?
APM software traces transactions across tiers, technologies
How you can learn M Grammar for Oslo modeling
Legacy modernization opens Windows for publisher
Former .NET Web developers ride Ruby and Rails application framework
Microsoft Oslo at PDC: Dial 'M' for modeling language
Yahoo proxy fight looms
New Microsoft site for architects
LAMP coders go hybrid route
Silverlight shines on bank RIAs
Microsoft .NET Web services Research

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
Common Language Infrastructure  (SearchSOA.com)
Visual J#  (SearchSOA.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


output statements for messages that you might want to view after the program has been placed in production. In practice, I've found it much more convenient to ignore Debug and use only Trace output, reserving the Verbose trace level (described below) for debug-level messages.

Although the following discussion describes only the Trace class, the discussion applies equally to the Debug class unless otherwise noted. The process of adding trace statements to your program is called instrumentation. The Trace class defines six different output methods:

The Assert and Fail methods not only output messages, but also pop up dialog boxes that display an error message and allow you to Abort the program, Retry the operation, or Ignore the error. You probably do not want to use Assert and Fail in programs that are supposed to run unattended.


Read more about tracing in InformIT's .NET Reference Guide.


Rate this Tip
To rate tips, you must be a member of SearchSOA.com.
Register now to start rating these tips. Log in if you are already a member.




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



SOA Trends and Strategy - SOA Education, SOA Development, SOA Implementations
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2001 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts