Studying for the 7-536 Microsoft exam & made some note for Chapter 10 on Instrumentation.
Chapter 10 Instrumentation
Lesson 1 Logging Events
Instrumentation = Logging & measuring what happens on in apps.
The windows event log mechanisms is a convenient for devs to record info that maybe useful to users
Many ways to log info, but the event log mechanism provides a clean, way to handle the task.
Use the source property of the Eventlog to define where info is from
Use the EventLogEntryType to specify what type of entry the output will be
Primary object for interacting with the event log system is the EventLog class in the System.Diagnostics namespace
Although the Eventlog class provides functionality it uses many resources & should be used judiciously
Many security vulnerabilities can be raised when using EventLog objects. Avoid using them in partial trust environments
Use the Clear method to remove all entries in an event log
The Message property of the EventLogEntry is used to read back the info that was written to the EventLog object.
Lesson 2 Debugging & Tracing
The debug & trace classes are tools devs can use to examine execution of apps
Write, Writeline, Writeif & WriteLineIf methods all can be used to send output to attached listener objects
The Assert method of the Debug & Trace classes can be used to test a condition of code
Listener objects are used as receptacles for debug & trace info
If no listener object is specified, the DefaultTraceListener is used
XMLTraceListener can be used to output details in XML format
The TraceSource class allows the dev to specify info about the source of the trace info
The TraceSwitch allows the dev to manipulate every aspect of the TraceSource class.
Lesson 3 Monitoring Performance
A Process is an executing app with a unique identifier to differentiate from other processes.
The Start method of the Process class allows apps to be started programmatically. The GetProcesses method of the Process class returns info on all running processes on pc. GetProcessByName or GetProcessByID can be used to get a single process info.
To pass values into the constructor of the Main method, command line arguments can be specified.
The StackTrace object provides detailed info about the state of execution for an app. StackFrame objects make up the StackTrace object. StackFrame objects are intended to support the .NET framework & should not be used directly.
Because String objects reference types. There is a potential security risk when storing passwords. SecureString class is used to store sensitive data.
PerformanceCounter objects are mechanisms that allow specific measurements of an app resource utilization.
Lesson 4 Detecting Management Events
WMI is a component of the Windows OS that provided monitoring functionality
EventQuery class is used in .NET to represent a WMI query
Win32_Service object can be use to query info about windows services
ManagementQuery base class is used a foundation of all management query objects.
The ManagementObjectSearcher is used to query system resources though WMI
Chapter 10 Summary
Windows Event logging is an excellent way to record info on apps.
Debug & Trace classes allow info to be tracked
Listener Objects provide a location Debug & Trace output
Windows Management Instrumentation WMI & the System.Management namespace provide a framework for querying on system resources.
DebuggerVizualizerAttribute & DebuggerPRoxyType are new attributes in VS05 to help debug.