Skip to main content

Dynamics 365 Tracing and InRule Event Logging

Dynamics 365 Plug-In Trace Logging​

The Dynamics Plug-In Trace Log feature is a debugging tool made available within Dynamics itself for reviewing plugin events and exceptions. This section will highlight how to enable this feature within Dynamics and how to utilize it. Currently, Plug-In Trace Logs only work with the Execution Service in online deployments. For more detail on the limitations of on-prem deployments, reference Known Issues, Limitations and Troubleshooting.

Enable Plug-In Trace Log​

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

Dynamics 365 navigation with numbered callouts on the Sales menu (1), the Settings tile (2), and Administration under System (3)

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

Administration page with System Settings highlighted (callout 4)

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. This will create trace logs for all plugin events within your Dynamics environment. In the context of InRule, this includes Create, Update, and Custom Action events.

System Settings Customization tab (callout 5) with the Enable logging to plug-in trace log drop-down set to All (callout 6)

Viewing Plug-In Trace Log​

To review Plug-In Trace Logs after they have been enabled, navigate to Settings > Plug-in Trace Log.

Dynamics 365 navigation with numbered callouts on the Sales menu (1), the Settings tile (2), and Plug-In Trace Log under Customization (3)

Here, there will be a list populated with all logged plugin events. If you do not see a list of logs in a similar fashion as below, that means no plugin events have been logged.

Plug-in Trace Log list of InRule.Crm.ServicePlugins.OnlinePlugin entries for the inrule_RulesEngineAction message with execution start times

For this example, we will view the resulting log of executing a Custom Action from manually running rules. To view a specific log, simply click on the hyperlinked Type Name text.

The first section within a specific trace log is the Configuration section, which details the various configuration details about the event, including the Rule Configuration ID used, the event type, the plugin step ID, and more. This section can be useful for debugging by providing a quick means of determining whether or not the rules executed were properly configured.

Plug-in trace log Configuration section showing Type Name, Message Name inrule_RulesEngineAction, Configuration ID, Plugin Step Id, Depth, Mode Synchronous, Correlation Id, and Request Id

The second section, the Execution section, is typically the most useful for debugging. It will provide a block of all messages logged by the plugin during its execution, as well as any exception details, if the event resulted in an exception.

Plug-in trace log Execution section with the Message Block listing original input parameters and the Exception Details for an unhandled System.ServiceModel.FaultException with a NullReferenceException stack trace

The message block logs rule execution "milestones." In the event that the plugin fails to execute properly, the message block is useful for determining at what point it is failing. The Exception Details block will provide any related details to any exception thrown and is generally the first place to look to diagnose the nature of a plugin execution failure.

Additionally, when interested in performance information, the application logs will also provide insight into data loading time. As can be seen below, this is broken up into total loading time, which is how long the entire loading process takes with internal processing included, total org time, which is strictly the summed total of all entity loading times, and then loading times for each collection loaded. This will also display the total number of entities in each collection.

Entity Loading log output showing Total Loading Time 233.2697ms, Total Org Service Time 216ms, and the related entities loaded for each collection with their times

Rule Execution Service Event Log​

Event logging can be enabled in the Rule Execution App Service to monitor application events. These logs can be tremendously useful for debugging any issues encountered with the Rule Execution Service.

Configuring Event Logging Levels​

The Application Event Log can quickly become bogged down with too many logs, making finding specific logs that you may be interested in more difficult. To cut down on excessive informational logs, the Rule Execution Service, by default, will be deployed with a logging level of "Warn," meaning only Warnings and Errors will be logged. However, this can be adjusted as needed for whatever your needs may be.

To adjust your Rule Execution Service's logging level, navigate to your App Service as created as a part of the Azure deployment process detailed in Rule Execution App Service for Dynamics 365

Once you're looking at the overview of your app service, select Configuration in the settings menu:

Azure App Service overview with Configuration highlighted in the Settings menu

Scroll down until you see the Configuration section:

Application settings list with the inrule:logging setting highlighted

Locate the inrule:logging:level setting. Note that its value is currently set to "Warn."

inrule:logging application setting with the value Warn

Simply change the value to the desired logging level. You may select from one of the following levels that the Rule Execution Service leverages:

Logging LevelDetails
InfoLogs all application events, including Informational events that track the general flow of the application
WarnLogs Warning and Error events. Warning events highlight abnormal or unexpected events in the application flow, but don't otherwise cause application execution to stop
ErrorLogs only Error events. Error events result in the halted execution of the application's current activity due to a failure

Once you have configured the setting to the desired level, press Save at the top of the page:

Application settings page with the Save button highlighted

Viewing Application Event Logs​

To view event logs, login to Azure and navigate to your App Service as created as a part of the Azure deployment process detailed in Rule Execution App Service for Dynamics 365.

Once you're looking at the overview of your app service, select Diagnose and solve problems

Azure App Service overview with Diagnose and solve problems highlighted in the menu and as a card

Select Diagnostic Tools

Troubleshooting categories with the Diagnostic Tools card highlighted

Select Application Events Logs

Support Tools with the Application Event Logs card highlighted

You should see a list of all application events logged by the rule execution service, denoted with the notification level, timestamp, source, event ID, and web server. Selecting an event log will cause the log details to appear below the list of logs.

Application Event Logs list of Info events with the selected event's RuleSession.ExecuteRuleSet timing details shown below

In the event of rule service issues, error events in this log stream can be useful for debugging purposes. For example, below is an example of an error event log in an instance where the rule service contacting the catalog looking for a rule application that didn't exist:

Error event log from WcfCatalogProxy stating Rule application 'DynamicsRules2' does not exist in the catalog, with version, operating system, and InRule.Repository.Service.InRuleCatalogException error information

Typically, the response message at the beginning of the log and the Error Information section provides the most pertinent debugging information.