With the release of CRM Online Spring 2015 Update, Microsoft provided a long awaited feature for developers that we are really excited about. That feature is a built-in Plug-In Trace Log that allows developers to utilize the existing ITracingService and provide a way to see any traces without requiring an error to occur to see the trace.
Here’s how it works:
- First we need to enable the Plug-In Trace Log within the System Settings under the Customization tab. You can choose to log only Exceptions or both Exceptions and Traces.
- Next, utilize the ITracingService to write out a trace and/or throw an Exception within a plug-in
- Next, register your plug-in on the desired step as normal. In my example I am registering it on Create of an Account
- When I attempt to Create an Account record then I receive an error message with the exception that I wrote in the plug-in
- Now Navigate to the new link in Settings –> Plug-In Trace Log
- You should see a grid of all the Plug-In Trace Logs per plug-in execution
- Open up the trace record and you will see the details of any traces and exceptions that occurred with the plug-in. It also provides the duration of the plug-in execution which will definitely come in handy for performance testing.
As you can see, this feature will come in handy and should eliminate the need to use a custom entity to store any log entries. It also eliminates the need to require users to click the “Download Log” button on the error dialog in order to send the log file when an error occurs.