In the past, plugin debugging has been a very challenging task when working with CRM online environment, due to the lack of a proper way to log error trace information.
The good news is, CRM Online 2015 Update 1 release has introduced a new feature which allows you to turn on plugin trace logging, debugging plugin code for CRM online server is no longer such a daunting job.
How to turn on Plugin Trace Logging
To turn on CRM plugin trace logging, you would navigate to Settings -> Administration -> System Settings.
Then you would navigate to Customization tab, and choose the desired option under "Plug-in and custom workflow activity tracing" section.
Note that although you are only seeing two options in the above screenshot, the final release will contain the following 3 options.
- Off - Writing to trace log is disabled.
- Exception - A PluginTraceLog record will be created when an exception is thrown in your plugin or workflow code.
- All - PluginTraceLog records will be created whenever you make a call to tracingService.Trace method (tracingService is an instance of ITracingService), or anytime when an exception is thrown in your plugin or workflow code. Use this option with extra caution, as it could affect your system performance if you have been using tracing services extensively in your plugin code.
How to view Plugin Trace Log records
After you have chosen either one of the last two options (Exception or All), CRM system will record a log entry to the newly introduced PluginTraceLog entity when the corresponding event happens (a call to tracingService.Trace method or when an exception is thrown). To view the trace log records, you would navigate to Settings -> Customizations -> Plug-in Trace Log as shown below.
The trace log record will be able to help you troubleshoot your CRM plugin or workflow code.
Some Final Thoughts
For more details about this particular feature, please check out the following documentation link from CRM SDK team.
Hope you like this feature.
Read the full New SDK Capabilities Blog Series:
- Part 1 - Alternate Keys
- Part 2 - Upsert
- Part 3 - No more special messages for special fields
- Part 4 - Plugin Trace Logging
- Part 5 - Entity Change Tracking
- Part 6 - Transactional Batching
- Part 7 - Optimistic Concurrency
- Part 8 - New Query Operators
- Part 9 - Detect SDK Capabilities by Checking CRM Server Version