转载:How to enable tracing in Microsoft Dynamics CRM

This article describes how to enable tracing in Microsoft Dynamics CRM.

MORE INFORMATION

Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems might occur if you modify the registry incorrectly. Therefore, make sure that you follow these steps carefully. For added protection, back up the registry before you modify it. Then, you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click the following article number to view the article in the Microsoft Knowledge Base:
322756? (http://support.microsoft.com/kb/322756/ ) How to back up and restore the registry in Windows
Microsoft Dynamics CRM lets you create trace files that monitor the actions that are performed by Microsoft CRM. Trace files are helpful when you have to troubleshoot error messages or other issues in Microsoft CRM.

You can create unmanaged trace files and managed trace files. The information in the unmanaged trace files and in the managed trace files is determined by required and optional registry entries that you create manually. You create these registry entries on the Microsoft CRM server or on the computer that is running the Microsoft CRM client for Microsoft Office Outlook after you install Microsoft CRM or the Microsoft CRM client for Outlook.

Required registry entries

The following are the required registry entries. For more information about the location of these registry entries, see the "Registry entry locations" section.
Collapse this tableExpand this table
Name Type Data value Notes
TraceEnabled DWORD A value of 0 or 1 If you use a value of 0, tracing is disabled. If you use a value of 1, tracing is enabled.
TraceDirectory String C:\CRMTrace The TraceDirectory registry entry specifies the directory for the trace log files. The directory must exist, and the user who starts the Microsoft CRMAppPool must have full control over this directory. When you install Microsoft CRM, the default user is NT AUTHORITY\NETWORK SERVICE.
TraceRefresh DWORD A number between zero and 99 When the data is changed, the trace settings in the other trace registry entries are applied.

Optional registry entries

The following are the optional registry entries.
Collapse this tableExpand this table
Name Type Data value Notes
TraceCategories String or Multi-String Category.Feature:TraceLevel The TraceCategories registry entry is a combination of a category, a feature, and a trace level. You can specify multiple categories, features, and trace levels. Separate each combination by using a semicolon. For a list of categories, features, and trace levels and for sample combinations that are valid, see the "Trace level values" section.
TraceCallStack DWORD A value of 0 or 1 If you use a value of 0, the call stack is not included in the trace file. If you use a value of 1, the call stack is included in the trace file.
TraceFileSizeLimit DWORD A size between 1 and 100 megabytes The TraceFileSizeLimit registry entry specifies the maximum size of trace files. New files are created when the limit is reached.
If you do not create the optional registry entries, the default data values are used. For more information about the default data values, see the "Default data values for optional registry entries" section. If you create the registry entries but do not specify data values for the registry entries, tracing will not work.

Microsoft Dynamics CRM 4.0 trace log file location

When you create a trace in Microsoft Dynamics CRM 4.0, the TraceDirectory registry key is ignored. For tracing on the Microsoft Dynamics CRM 4.0 server, the trace log file is created in the following folder:
Drive:\Program Files\Microsoft Dynamics CRM\Trace
For tracing on the Microsoft Dynamics CRM 4.0 client for Microsoft Office Outlook and for tracing on Microsoft Dynamics CRM 4.0 Data Migration Manager, the trace log file is created in the following folder:
DriveName:\Documents and Settings\ InstallingUser \Application Data\Microsoft\MSCRM\Traces

Registry entry locations

The Microsoft CRM server tracing registry entries are located in the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\MSCRM
The Microsoft CRM client for Outlook tracing registry entries are located in the following registry subkey:
HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\MSCRMClient
The Microsoft CRM Data Migration Manager tracing registry entries are located in the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\DATA MIGRATION WIZARD

Complete list of category values for the TraceCategories registry entry

  • *
  • Application.*

    The Application.* category includes the following:
    • Application.Outlook
  • Exception
  • ObjectModel
  • ParameterFilter
  • Platform.*

    The Platform.* category includes the following:
    • Platform.ImportExportPublish
    • Platform.Sdk
    • Platform.Metadata
    • Platform.Sql
    • Platform.Workflow
    • Platform.Soap
  • SchedulingEngine.*
  • Unmanaged.*

    The Unmanaged.* category includes the following:
    • Unmanaged.Outlook
    • Unmanaged.Platform
    • Unmanaged.Sql

Trace level values

Complete list of valid trace level values for TraceCategories

  • Off
  • Error
  • Warning
  • Info
  • Verbose
Note A message is logged only if the trace level for the category is equal to or greater than the level of the message. For example, a trace level of Warning logs messages that have a level of Warning and of Error. A trace level of Info logs messages that have a level of Info, of Warning, and of Error. A trace level of Verbose logs all messages. You should only use a trace level of Verbose for short durations.

Sample category and trace level combinations

  • *:Verbose

    Note The *:Verbose combination logs all messages in all categories. You should only use the *:Verbose combination for short durations.
  • Application.*:Error

    Note The Application.*:Error combination logs all messages that have a level of Error for the Application.* category.
  • Platform.*:Warning

    Note The Platform.*:Warning combination logs all messages that have a level of Warning or Error for the Platform.* category.

Default data values for optional registry values

  • TraceCategories: *:Error
  • TraceCallStack: 0
  • TraceFileSizeLimit: 5

Microsoft Dynamics CRM 4.0 E-mail Router

You can update the Microsoft Dynamics CRM E-mail Router to enable tracing. To do this, you must modify the registry and XML service configurations.

To enable verbose operations log level, you must manually update the configuration by updating the registry. To do this, follow these steps:
  1. Log on to the server where the Microsoft CRM E-mail Router is installed with local administrator privilege.
  2. Click Start, click Run, type regedit, and then click OK.
  3. Locate and then click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSCRMEmail
  4. Right-click the LogLevel registry entry, click Modify, and then change the value to 3. By default, this value is set to 1.
  5. Update the Microsoft.Crm.Tools.EmailAgent.xml configuration file for the E-mail Router Service. To do this, follow these steps:
    1. In Windows Explorer, locate the Microsoft.Crm.Tools.EmailAgent.xml file. By default, this file is located in the following folder:
      SystemDrive:\Program Files\Microsoft CRM Email\Service
    2. Open the file by using Notepad or another text-editing program.
    3. In the file, examine the <SystemConfiguration> node, and then scroll down the text toward the end of the file to find the following statement:
      <LogLevel>1</LogLevel>
      By default, this value is set to 1 (one). Modify this statement so that it reads as follows:
      <LogLevel>3</LogLevel>
    4. Save the file.
    5. Restart the E-mail Router Service. You will find a new event viewer log view that is named MSCRMEmailLog. It is in this event viewer log view that the events appear.

How to enable scheduled tracing

  1. Set up the trace. When you set up the trace, enter all the required values. However, leave the TraceEnabled registry entry set to 0.
  2. Create a registry file that enables the trace. To do this, start Notepad, copy the following information to the document in Notepad, and then save the document as a .reg file:
    Windows Registry Editor Version 5.00 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM] ?TraceEnabled?=dword:00000001
  3. Create a batch file that calls the .reg file. To do this, open a new document in Notepad, and then copy the following lines to the document in Notepad.

    Note In the lines that you copy, replace the <C:\Enable.reg> placeholder with the path and the file name of the actual .reg file that you created in step 2.
    @echo off
    regedit /s "<C:\Enable.reg>"
    exit
  4. In Control Panel, add a new scheduled task that runs the new batch file that you created in step 3. Schedule the task for the time at which you want the trace to run.

How to disable scheduled tracing

  1. Create a registry file that disables the trace. To do this, start Notepad, copy the following information to the document in Notepad, and then save the document as a .reg file:
    Windows Registry Editor Version 5.00 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM] ?TraceEnabled?=dword:00000000 "TraceRefresh"=dword:00000003
    Note You must change the value of the TraceRefresh registry entry. If you do not change the value of the TraceRefresh registry entry, the trace will not be disabled.
  2. Create a batch file that calls the .reg file. To do this, open a new document in Notepad, and then copy the following lines to the document in Notepad.

    Note In the lines that you copy, replace the <C:\Disable.reg> placeholder with the path and the file name of the actual .reg file that you created in step 2.
    @echo off
    regedit /s "<C:\disable.reg>"
    exit
  3. In Control Panel, add a new scheduled task that runs the new batch file that you created in step 3. Schedule the task for the time at which you want the trace to be disabled.

APPLIES TO
  • Microsoft Dynamics CRM 4.0
  • Microsoft Dynamics CRM 3.0
Keywords:?
kbcrmv3c kbmbsmigrate kbinfo KB907490
posted @ 2009-09-29 10:11  Bryan Wong  阅读(394)  评论(0)    收藏  举报