Diagnostics and Logging in ASP.NET

Key points from K. Scott Allen's article :

The ability to record and retrieve diagnostic information is an important characteristic of robust software. Diagnostic information could include the amount of time needed to execute a critical method, the number of transactions committed per second, or the number of users currently with active sessions.

The three keys to successful diagnostics include:
1) Making a list of requirements.
2) Matching those requirements to the available diagnostic and logging features.
3) Implementing a layer inside your software to make logging flexible, configurable, and effective.


Strategies to choose from:
  • ASP.NET Tracing - ASP.NET has built in tracing capabilities at the Page and Application level
  • Performance Counters - great place for your application to expose high frequency events
  • Event Log - can be both a source and a destination for diagnostic information. Not well suited for high frequency events.
  • Web Logs - useful for retrieving information about file not found errors among other things.
  • Email, Files, and Databases - Other places to write diagnostic information besides event log and performance counters
  • Logging & Diagnostic Software - log4net or Logging Application Block from Microsoft.

Comments