• Skip to main content
  • Skip to primary sidebar
  • Skip to footer
  • Home
  • Blog
  • Power Platform
    • Power Apps
    • Power Automate
    • Power BI
    • Power Virtual Agents
  • Dynamics 365
  • Azure
  • About Me
Joe Gill Logo

Joe Gill

Microsoft MVP - Power Platform Consultant

Home » Power Platform » Dynamics 365 » Tracing in Dynamics CRM Custom Assemblies

Tracing in Dynamics CRM Custom Assemblies

9th July 2016 by Joe Gill Leave a Comment

When writing custom assemblies for Dynamics CRM you can add  trace messages to your code to help track down problems and  identify performance issues. Trace messages can logged by initializing the tracing service in your code and calling the Trace method. I usually add the execution time as part of my trace messages especially when calling external services as this can be a performance pain point which may be difficult to track down.


ITracingService logger = (ITracingService)ServiceProvider.GetService(typeof(ITracingService));

logger.Trace(DateTime.Now.ToString(“mm:ss:ffff”) + “: Calling FX Rate”);
this.callFxRest();
logger.Trace(DateTime.Now.ToString(“mm:ss:ffff”) + “: FX Rate”);
 
 



If an exception is raised in a plugin the traces messages are included in the error text returned to the user.

Tracing in Dynamics CRM Custom Assemblies Joe Gill Dynamics 365 Consultant


To can view your trace logs you need to enable logging in System Settings -> Customizations. You can then select if you want tracing enabled just for Exceptions or All.

Tracing in Dynamics CRM Custom Assemblies Joe Gill Dynamics 365 Consultant

Once logging is enabled you go Settings -> Plug in Trace Log to see the logs files. Note that the log files are created asynchronously so there may be a slight delay for your log to appear after execution.

Tracing in Dynamics CRM Custom Assemblies Joe Gill Dynamics 365 Consultant



Share This On Social:
  • Tweet
  • Tracing in Dynamics CRM Custom Assemblies Joe Gill Dynamics 365 Consultant

Filed Under: Dynamics 365

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Popular Categories

  • Power Platform
    • Power Apps
    • Power Automate
    • Power Virtual Agents
  • Azure
    • Logic Apps
  • Dynamics 365
  • .NET
  • AI
  • SQL

More to See

Power Platform Requests – Base Request Capacity

17th December 2020 By Joe Gill

Power Automate Desktop

Power Automate Desktop – UI Flow

26th November 2020 By Joe Gill

Tweets

Footer

Joe Gill

Microsoft Business Applications MVP – Power Platform, Dynamics 365 and Azure.

An architect with over twenty years experience designing and developing technology solutions. Specializing in the Microsoft technology stack including Power Platform, Dynamics 365 and Azure. Microsoft MVP Profile

Connect on Social

Useful Links

  • Home
  • Blog
  • About Joe Gill
  • Power Platform
  • Dynamics 365
  • Azure

Featured Posts

Power Platform Requests – Base Request Capacity

Power Automate Desktop – UI Flow

MB-600 – Solution Architect – Supportability

AI Builder – Form Processing Layouts

© 2021 · Joe Gill