Use Tracing in CRM 2011 Plugins

By | January 17, 2011

CRM SDK provides way for you to include the debug details about your plug-in in case you need to trace the plug-in execution. For this you will have to initialize the “ITracingService”. The service provides way to trace the details and display it whenever plug-in fails and throws an exception.

//Initialize the service
ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

Once initialized, you just need to add the logical and meaningful details as per your logic using below code,
tracingService.Trace(yourMessage);

Shown below is the example of message shown to the user when plug-in fails and throws exception.


Hope this helps you how to use Tracing in CRM 2011 plugins!

Leave a Reply