I haven't tried it myself, but you can take a look at the Enterprise
Instrumentation Framework:
http://msdn.microsoft.com/vstudio/productinfo/enterprise/eif/
The Microsoft Enterprise Instrumentation framework (EIF) enables
applications built on the .NET Framework to be instrumented for
manageability in a production environment. This framework provides an
extensible event schema and unified API which leverages existing eventing,
logging and tracing mechanisms built into Windows, including WMI, the
Windows Event Log, and Windows Event Tracing. An application instrumented
with this framework can publish a broad spectrum of information such as
errors, warnings, audits, diagnostic events, and business-specific events.
In addition, Enterprise Instrumentation enables tracing by business-process
or application service, and can provide statistics such as average execution
time for a given process or service.