718 Washington Ave. N. Suite #101
Minneapolis, MN 55401
View map and all Locations

Send us a message

Dynamics CRM developers can sometimes find it difficult to debug plug-ins for CRM Online since they don’t have the luxury to debug them the same way they do it while writing plug-ins for CRM On-premises. Luckily, a new feature called Plug-in Trace Log was included with Dynamics CRM 2016, and in today’s blog, we’ll be showing you how you can debug your plug-ins using this new feature.

Plug-in Trace Log

The Plug-in Trace Log feature saves trace log information, similar to the information you get when an asynchronous plug-in throws an exception, with the advantage that trace log information will be available even when the plug-in doesn’t throw an exception. The steps needed to use this feature are broken down below.

1. Write the Plug-in

First, let’s write a simple plug-in to test the new Plug-in Trace Log feature. Notice that in the sample code below, we added an instance of ITracingService to log information about the execution of the plug-in as well as logging some key values:

Plug-in Trace Log

2. Register the Plug-in

For this exercise, we will register this plug-in as follows:

Plug-in Trace Log

3. Enable Plug-in Trace Log

To enable the Plug-in Trace Log, first navigate to Mail > Settings > Administration.

Plug-in Trace Log

Once you’re in the Administration section, click on System Settings.

Plug-in Trace Log

From here you can navigate to the Customization tab and select All for the Enable logging to plug-in trace log field. Then click OK.

Plug-in Trace Log

Test the Plug-in Trace Log

To test the Plug-in Trace Log, open any Account record, update the Fax Number and click on Save.

To check the Plug-in Trace Log entries, click on Main > Settings > Plug-in Trace Log.

Plug-in Trace Log

Double click on the entry created right after you updated the Account record. Keep in mind that the Trace Log record is created asynchronously, it might take a few seconds for the entry to show in the view.

Plug-in Trace Log

Once the Trace Log record opens you can investigate the information captured. This page will provides valuable information such as Type Name, Message Type, Primary Entity, Depth, Mode, etc.

Plug-in Trace Log

Scroll down and check the Message Block under the Execution tab. This is where you will find the trace log information you configured in your plug-in.

Plug-in Trace Log

IMPORTANT: only enable the Plug-in Trace Log feature if you are debugging or tweaking a plug-in. You don’t want to create thousands of trace log records if you are not debugging a plug-in.

That’s all for the blog today! You can learn more about the features included in Dynamics CRM 2016 by subscribing to our blog as well as viewing our numerous Webinars on Demand. The CRM Book has been updated to include content for Dynamics CRM 2016 as well, so make sure you check it out!

Happy CRM’ing!

Avatar for Joe D365

Joe D365

Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.