Professional C# 4 and .NET 4
by Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner
Chapter 19. Instrumentation
WHAT'S IN THIS CHAPTER?
Code contracts
Tracing
Event logging
Performance monitoring
This chapter helps you to get live information about your running application to find the issues that your application might have during production or to monitor resources needed to adapt earlier to higher user loads. This is where the namespace System.Diagnostics comes into play.
One way to mark errors in your application, of course, is by throwing exceptions. However, an application might not fail that badly, but still not behave as expected. The application might be running well on most systems, but might have a problem on a few. On the live system, you can change the log behavior by changing a configuration value and get detailed live information about what's going on in the application. This can be done with tracing.
If there are problems with applications, the system administrator needs to be informed. With the Event Viewer, the system administrator can both interactively monitor problems with applications and be informed about specific events that happen by adding subscriptions. The event-logging mechanism allows you to write information about the application.
To analyze resources needed from applications, monitor applications with specified time intervals, and plan for a different application distribution or the extension of system resources, the system administrator can use the Performance Monitor. You can write live data from your application by using performance counts ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access