Microsoft Dynamics CRM 2011 Cookbook
上QQ阅读APP看书,第一时间看更新

Enabling server-level tracing

This recipe guides us through the tracing feature while providing the method to enable server-level tracing.

Getting ready

Tracing is a helpful feature for capturing valuable information while debugging or fixing any errors or warnings within the Dynamics CRM 2011 servers.

Note

Tracing is not available for the Microsoft Dynamics CRM Online version.

Enabling tracing, however, has performance implications. Because of its resource-intensive nature, tracing slows down the performance of the server. Another warning on tracing is that it might log sensitive information and should be handled very carefully.

Note

Tracing is disabled by default and the standard recommendation is to keep it disabled unless some error or warning debugging activity has to be performed.

There are two methods of enabling tracing in Microsoft Dynamics CRM 2011 Server. These are as follows:

  • Server-level tracing: By enabling server-level tracing, only the current server machine where tracing is enabled can be monitored. Server-level tracing does not require any specific server role to be running in the computer, and it can provide a greater degree of control, where we can set specific trace values such as which Microsoft Dynamics CRM 2011 features to trace or the maximum trace file size.

    Server-level tracing has to be manually set in the Windows registry on the computer where one or more Microsoft Dynamics CRM 2011 server roles are running.

  • Deployment-level tracing: By enabling deployment-level tracing, all the machines that are running various Dynamics CRM 2011 server roles and services would be monitored regardless of the server roles installed on the local computer where tracing is enabled.

    With deployment-level tracing enabled, all the server roles, such as Asynchronous Service, Sandbox Processing Service, Unzip Service, the web application (w3wp), and deployment tools (mmc-Tools), are monitored. Corresponding trace files are created.

    Deployment-level tracing is enabled using the Windows PowerShell command and is maintained in the MSCRM_CONFIG database.

    Note

    Deployment-level tracing can only be enabled from a computer that has the Microsoft Dynamics CRM 2011 Deployment Tools server role.

    If both deployment-level and server-level tracing are enabled on the same computer, only server-level tracing will be used.

To enable server-level tracing, certain registry changes have to be made on the Dynamics CRM 2011 server computer. Now the recommended practice is to back up the registry before any changes are performed. So before enabling tracing, back up the registry and save it in a safe location so that we can restore it if required.

How to do it…

To enable server-level tracing, perform the following steps:

  1. Log in to the Dynamics CRM 2011 Server machine as a local machine administrator.
  2. Launch the Registry Editor application by going to the Start menu and clicking on Run. Then, type regedit and click on OK.
  3. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM in the registry.

    Create the following mandatory registry keys for enabling tracing.

  4. Right-click and select New | DWORD (32-bit) Value.
  5. Enter the key name as TraceEnabled and value as 1 as shown in the following screenshot:
  6. Right-click and select New | DWORD (32-bit) Value. Then enter the key name as TraceRefresh with a value between zero 0 and 99. Actually, the data value does not matter; the act of changing the value of this registry subkey will trigger a trace setting change in the system:

    Now, there are a few optional registry keys that can be added.

  7. Add a String or Multi-String value with the name TraceCategories and the value in the format Category.Feature:TraceLevel. You should know that TraceCategories is a combination of category, feature, and trace levels.

    One of the examples of the value would be Application.*.Error; it is going to capture the error logs for all the application features. Another example could be Platform.Sql.Verbose that would capture verbose logs of interactions with SQL Server.

  8. Add a DWORD with the name TraceCallStack and decimal value of either 0 or 1.

    A value of 1 would mean the call stack would be included in the trace log and a value of 0 would mean the call stack would not be included.

  9. Add a DWORD with the name TraceFileSizeLimit and decimal value between 1 and 100. This value will specify the maximum size of the trace files. New files will be created in case the maximum size is reached.

How it works…

These registry keys have to be created with the values previously specified. If the registry keys have been created with default values, tracing will not be enabled.

For the TraceEnabled mandatory registry key, a value of 0 means tracing is disabled and a value of 1 means it is enabled.

If the optional registry keys have not been created, the default values for these keys will be used by tracing. The default values for the optional registry keys are:

The complete list of category values for TraceCategories is as follows:

Note

Unless changed, the tracing files are located at C:\Program Files\Microsoft Dynamics CRM\Trace.