web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Blogs / CRM TIPS By PRM / Plugin Trace Logs in CRM 20...

Plugin Trace Logs in CRM 2015 Update1

P. R. M Profile Picture P. R. M 739

About Plugin Trace Logs:

Dynamics CRM 2015 SP1 has introduced a new feature named as “Plugin Trace Logs”.

In past versions of CRM we used ITracingService, which allow the end users / developers to download the log file or if the plugin is registered asynchronously the tracing information is shown in System jobs.

But, with this new feature developers can troubleshoot error in plugins/custom workflows more efficiently while using ITracingService. This feature will capture the trace messages, error logs and create a record in a new system entity called “Plug-in Trace Logs”

Tracing Supports for Sandboxed or fully trusted registered custom code during synchronous and Asynchronous execution. Tracing does not support for custom code that executes in Outlook client or in Mobile client.

Steps for Enabling Plugin Trace Logs in CRM:

  1. Login to CRM System
  2. Navigate to Settings -> Administration -> Select “System Settings”

PluginTraceLog_Settings

  1. Click on Customization Tab. You can observe Enable logging to Plug-in Trace Log.

PluginTraceLog_SystemSettings

  1. For Enable Logging to Plug-in Trace Log you can observe different options such as “Off/Exception/All”.
  2. Set it to Either All/Exception

Options for Enabling Plug-in Trace Logs:

We have 3 options to enable Plug-in trace logs as below:

OFF

By default setting will be in off i.e., this feature is turned off so writing to the trace log is disabled and No PluginTraceLog records will be created. However, custom code can still call the “Trace” method even though no log is written.

Exception

The trace logs will be captured and record will be created only if the exception has been thrown to the end user. Which means any unhandled exception is passed back to the CRM platform from the custom code then PluginTraceLog records will be created.

All

PluginTraceLog record will be created, Irrespective of Unhandled Exception in CRM or Tracing statements.

Sample Code in Plug-in/Custom workflow to get Trace Logs:

//Create Trace service to capture Trace logs

ITracingService tracingService =         (ITracingService)serviceProvider.GetService(typeof(ITracingService));

//Add trace string in plug-in code wherever required as below. This message will be written in Plug-in trace logs

tracingService.Trace(“tracing details”);

View Plug-in Trace files in CRM

We can observe record has been created and trace files has been captured under “Plug-in Trace Logs” Entity. We can view these records in 2 ways such as Advanced Find and Settings -> Plug in Trace Log.

PluginTraceLog_AFView

PluginTraceLog_EntityView

Trace information is written to the log upon code completion or an exception is passed back to the platform from the custom code.

PluginTraceLog_formview



This was originally posted here.

Comments

*This post is locked for comments