You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/logging-tracing.md
+41-56Lines changed: 41 additions & 56 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Logging and tracing (Common Data Service) | Microsoft Docs"
3
3
description: "Use the trace log to store plug-in execution information to aid in plug-in debugging."
4
4
ms.custom: ""
5
-
ms.date: 1/28/2019
5
+
ms.date: 05/05/2019
6
6
ms.reviewer: ""
7
7
ms.service: powerapps
8
8
ms.topic: "article"
@@ -17,97 +17,82 @@ search.app:
17
17
---
18
18
# Tracing and logging
19
19
20
-
An alternative method to troubleshoot a plug-in or custom workflow activity (custom code), compared to debugging in [!INCLUDE[pn_Visual_Studio](../../includes/pn-visual-studio.md)], is to use tracing. Tracing assists developers by recording run-time custom information as an aid in diagnosing the cause of code failures. Tracing is especially useful to troubleshoot [!INCLUDE[pn_CRM_Online](../../includes/pn-crm-online.md)] registered custom code as it is the only supported troubleshooting method for that scenario. Tracing is supported for sandboxed (partial trust) and full trust registered custom code and during synchronous or asynchronous execution. Tracing isn’t supported for custom code that executes in [!INCLUDE[pn_microsoft_dynamics_crm_for_outlook](../../includes/pn-microsoft-dynamics-crm-for-outlook.md)] or other mobile client.
20
+
Use tracing to troubleshoot a plug-in or custom workflow activity (custom code). Tracing assists developers by recording run-time information as an aid in diagnosing the cause of code failures. Tracing is supported for synchronous or asynchronous execution.
21
21
22
-
Recording of run-time tracing information for [!INCLUDE[pn_dynamics_crm](../../includes/pn-dynamics-crm.md)] apps is provided by a service named <xref:Microsoft.Xrm.Sdk.ITracingService>. Information provided to this service by custom code can be recorded in three different places as identified here.
23
-
24
-
> [!NOTE]
25
-
> Trace logging using `ITracingService` interface works only when the Plug-in is registered in Sandbox mode.
22
+
Recording of run-time tracing information for Common Data Service is provided by a service named <xref:Microsoft.Xrm.Sdk.ITracingService>. Information provided to this service by custom code can be recorded in three different places as identified here.
26
23
27
24
-**Trace log**
28
25
29
-
Trace log records of type **PluginTraceLog** can be found in the web application by navigating to **Settings** and choosing the **Plug-in Trace Log** tile. The tile is only visible if you have access to the trace log entity records in your assigned security role. Writing of these records is controlled by the trace settings mentioned in the next section.
30
-
31
-
> [!NOTE]
26
+
Trace log records are written to the [PluginTraceLog Entity](reference/entities/plugintracelog.md). Writing of these records is controlled by the trace settings mentioned in [Enable trace logging](#enable-trace-logging).
27
+
28
+
This data can be found in model-driven applications by navigating to **Settings** and choosing the **Plug-in Trace Log** tile. The tile is only visible if you have access to the trace log entity records in your assigned security role.
29
+
30
+
You may find it easier to view this data by using the Web API in your browser using the example shown in [Use Tracing](debug-plug-in.md#use-tracing) or by using the [Plug-in trace viewer](#plug-in-trace-viewer) community tool.
31
+
32
+
> [!IMPORTANT]
32
33
> Trace logging takes up organization storage space especially when many traces and exceptions are generated. You should only turn trace logging on for debugging and troubleshooting, and turn it off after your investigation is completed.
33
34
34
35
-**Error dialog**
35
36
36
-
A synchronous registered plug-in or custom workflow activity that returns an exception back to the platform results in an error dialog box in the web application presented to the logged on user. The user may select the **Download Log File** button in the dialog to view the log containing exception and trace output.
37
+
A synchronous registered plug-in or custom workflow activity that returns an exception from the platform results in an error dialog box in the web application presented to the logged on user. The user may select the **Download Log File** button in the dialog to view the log containing exception and trace output.
37
38
38
39
-**System job**
39
40
40
41
For asynchronous registered plug-in or custom workflow activities that returns an exception, the tracing information is shown in the **Details** area of the **System Job** form in the web application.
41
42
42
-
<aname="bkmk_trace-settings"></a>
43
-
## Enable trace logging
44
-
To enable trace logging in an organization that supports this feature, in the web application navigate to **Settings** > **Administration** > **System Settings**. In the **Customization** tab, locate the drop-down menu labeled **Enable logging to plug-in trace log** and select one of the available options.
45
-
46
-
|Option|Description|
47
-
|------------|-----------------|
48
-
|Off|Writing to the trace log is disabled. No **PluginTraceLog** records will be created. However, custom code can still call the <xref:Microsoft.Xrm.Sdk.ITracingService.Trace(System.String,System.Object[])> method even though no log is written.|
49
-
|Exceptions|Trace information is written to the log if an exception is passed back to the platform from custom code.|
50
-
|All|Trace information is written to the log upon code completion or an exception is passed back to the platform from the custom code.|
51
-
52
-
If the trace logging setting is set to **Exception** and your custom code returns an exception back to the platform, a trace log record is created and tracing information is also written to one other ___location. For custom code that executes synchronously, the information is presented to the user in an error dialog box, otherwise, for asynchronous code, the information is written to the related system job.
43
+
<aname="bkmk_trace-settings"></a>
44
+
45
+
## Enable trace logging
46
+
47
+
Whether trace logs will be written depends on the value of the [Organization](/powerapps/developer/common-data-service/reference/entities/organization) Entity [PluginTraceLogSetting](/powerapps/developer/common-data-service/reference/entities/organization#BKMK_PluginTraceLogSetting) attribute value.
48
+
49
+
To enable trace logging you can programmatically update this value or in the web application navigate to **Settings** > **Administration** > **System Settings**. In the **Customization** tab, locate the drop-down menu labeled **Enable logging to plug-in trace log** and select one of the available options.
53
50
54
-
By default, the System Administrator and System Customizer roles have the required privileges to change the trace logging setting, which is stored in a <xref:Microsoft.Xrm.Sdk.Deployment.TraceSettings> entity record. Trace settings have an organization scope.
|0|Off|Writing to the trace log is disabled. No **PluginTraceLog** records will be created. However, custom code can still call the <xref:Microsoft.Xrm.Sdk.ITracingService.Trace(System.String,System.Object[])> method even though no log is written.|
54
+
|1|Exceptions|Trace information is written to the log if an exception is passed back to the platform from custom code.|
55
+
|2|All|Trace information is written to the log upon code completion or an exception is passed back to the platform from the custom code.|
55
56
56
-
## Write to the tracing service
57
-
Before writing to the tracing service, you must first extract the tracing service object from the passed execution context. Afterwards, simply add <xref:Microsoft.Xrm.Sdk.ITracingService.Trace(System.String,System.Object[])> calls to your custom code where appropriate passing any relevant diagnostic information in that method call.
57
+
If the trace logging setting is set to **Exception** and your custom code returns an exception back to the platform, a trace log record is created and tracing information is also written to one other ___location. For custom code that executes synchronously, the information is presented to the user in an error dialog box, otherwise, for asynchronous code, the information is written to the related system job.
58
+
59
+
## Write to the tracing service
60
+
61
+
Before writing to the tracing service, you must first extract the tracing service object from the passed execution context. Afterwards, simply add <xref:Microsoft.Xrm.Sdk.ITracingService.Trace(System.String,System.Object[])> calls to your custom code where appropriate passing any relevant diagnostic information in that method call.
58
62
59
-
Download the sample: [Work with plug-ins](https://code.msdn.microsoft.com/Sample-Create-a-basic-plug-64d86ade).
60
63
61
64
```csharp
62
-
//Extract the tracing service for use in debugging sandboxed plug-ins.
65
+
//Extract the tracing service for use in debugging plug-ins.
Next, build and deploy the plug-in or custom workflow activity. During execution of the custom code, the information provided in the **Trace** method calls is written to a trace log entity record by <xref:Microsoft.Xrm.Sdk.ITracingService>, if supported by your organization and enabled, and may also be made available to the user in a Web dialog or system job as described in the previous section. Tracing information written to the trace log is configured in the trace settings. For more information see [Enable trace logging](#bkmk_trace-settings).
93
75
94
76
> [!NOTE]
95
-
>Ifyourcustomcodeexecuteswithinadatabasetransaction, andanexceptionoccursthatcausesatransactionrollback, allentitydatachangesbyyourcodewillbeundone. However, the**PluginTraceLog**recordswillremainaftertherollbackcompletes.
77
+
> If your custom code executes within a database transaction, and an exception occurs that causes a transaction rollback, all entity data changes by your code will be undone. However, the [PluginTraceLog](reference/entities/plugintracelog.md) records will remain after the rollback completes.
96
78
97
79
## Additional information about the tracing service
The <xref:Microsoft.Xrm.Sdk.ITracingService> batches the information provided to it through the **Trace** method. The information is written to a new [PluginTraceLog](reference/entities/plugintracelog.md) record after the custom code successfully runs to completion or an exception is thrown.
100
82
101
-
PluginTraceLogrecordshaveafinitelifetime. Abulkdeletionbackgroundjobrunsonceperdaytodeleterecordsthatareolderthan 24 hoursfromcreation. Thisjobcanbedisabled when needed.
83
+
[PluginTraceLog](reference/entities/plugintracelog.md) records have a finite lifetime. A bulk deletion background job runs once per day to delete records that are older than 24 hours from creation.
84
+
85
+
> [!CAUTION]
86
+
> While this job can be disabled or the frequency in which it occurs can be adjusted, failure to set it back to the original setting is frequently discovered to be the cause of performance issues later on.
**Plugin Trace Viewer** is a tool that XrmToolbox community developed. Please see the [Developer tools](developer-tools.md) topic for community developed tools.
Copy file name to clipboardExpand all lines: powerapps-docs/developer/common-data-service/org-service/quick-start-org-service-console-app.md
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
title: "Quick Start: Organization service sample (C#) (Common Data Service) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
3
description: "This quick start will show you how to connect to the organization service of the Common Data Service"# 115-145 characters including spaces. This abstract displays in the search result.
4
4
ms.custom: ""
5
-
ms.date: 10/31/2018
5
+
ms.date: 04/25/2019
6
6
ms.reviewer: ""
7
7
ms.service: powerapps
8
8
ms.topic: "article"
@@ -66,7 +66,7 @@ You will use the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xref:Microsoft.X
66
66
usingMicrosoft.Xrm.Tooling.Connector;
67
67
```
68
68
69
-
1. Replacethe `Main` methodwiththefollowingcode:
69
+
1. Replacethe `Main` methodwiththefollowingcode. Thesupportedvaluesfor *AuthType* are listed in [Connection string paramters](/dynamics365/customer-engagement/developer/xrm-tooling/use-connection-strings-xrm-tooling-connect#connection-string-parameters).
70
70
71
71
```csharp
72
72
staticvoidMain(string[] args)
@@ -75,7 +75,7 @@ You will use the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xref:Microsoft.X
@@ -100,7 +100,7 @@ You will use the <xref:Microsoft.Xrm.Sdk.IOrganizationService>.<xref:Microsoft.X
100
100
}
101
101
```
102
102
103
-
1. Editthefollowingvaluestoaddinformationfor your environment:
103
+
1. Editthefollowingvaluestoaddinformationfor your environment. You can find your environment URL in the Web application under **Settings > Customization > Developer Resources**.
title: "Test for a null value (Common Data Service) | Microsoft Docs"# Intent and product brand in a unique string of 43-59 chars including spaces
3
+
description: "This sample shows how to test for a null value by using the FilterExpression and QueryByAttribute classes"
4
+
ms.custom: ""
5
+
ms.date: 05/03/2019
6
+
ms.reviewer: ""
7
+
ms.service: powerapps
8
+
ms.topic: "article"
9
+
author: "KumarVivek"# GitHub ID
10
+
ms.author: "kvivek"# MSFT alias of Microsoft employees only
11
+
manager: "amyla"# MSFT alias of manager or PM counterpart
12
+
search.audienceType:
13
+
- developer
14
+
search.app:
15
+
- PowerApps
16
+
- D365CE
17
+
---
18
+
19
+
# Test for a null value
20
+
21
+
The following code example shows how to test for a null value by using the <xref:Microsoft.Xrm.Sdk.Query.FilterExpression> and <xref:Microsoft.Xrm.Sdk.Query.QueryByAttribute> classes.
22
+
23
+
## Example
24
+
Use this code to test for equality by using the <xref:Microsoft.Xrm.Sdk.Query.FilterExpression> class.
0 commit comments