Should we enable CRM tracing via the Registry or Powershell?
Answer: It depends.
Let me explain. First, let’s talk about why you would turn on CRM Platform tracing. If you encounter and error in CRM and you are not able to determine the resolution to the issue by the error message and\or downloading the platform error from the error message; the next step you may want to do is to enable CRM platform tracing. The CRM platform trace can give you more details about the entire call stack and verbose actions leading up to the error. This would be true for errors received in the CRM web client and in most cases errors in the CRM Outlook client. However, there is client side tracing you can enable as well if the error does not appear to be a server side error message. First let’s focus on server side tracing and then later I will include some details on client side tracing.
We have a KB article about How to enable platform tracing in Microsoft Dynamics CRM. This method walks you through enabling CRM platform tracing through the registry. There are also some third party tools like the Diagnostics Tool for Microsoft Dynamics CRM 2011 available on the Internet that customers and partners have written to automate this process. Even though those are not official Microsoft support tools, they are very commonly used with customers and partners and I personally haven’t seen any issues using these tools.
The registry is an effective way to enable platform tracing when you are troubleshooting an issue on a single CRM server. You can add the registry keys and you can leave them in place after you disable tracing, so that you can re-use them if needed at a later time. To disable tracing, you can simply change the TraceEnabled registry value to 0 and you also have to change the TraceRefresh value to a different number. I always just increment the decimal number by one. It’s very important to disable tracing when you are done troubleshooting, or you will fill up your C: drive.
Which leads us to my next point which is that the TraceDirectory is always ignored and no matter what you set this value to, the trace files will always go to <Install Drive>:\Program Files\Microsoft Dynamics CRM\Trace. Even if you change this in the registry or in a third party tool, the trace file will always go to the same directory. Typically this is not too big of an issue, unless you installed CRM on a drive that does not have much available hard drive space and then you have to enable tracing for a long period of time.
- You should go check that directory if you have enabled tracing in the past, or inherited this CRM Administrator role from someone else who may not have cleaned up old trace files.
- When using a Network Load Balanced (NLB) CRM deployment, you should try narrow down the issue to a single server, so that you only have to enable tracing on a single server. This will also save you from reading through extra trace files on servers that you were not even hitting while reproducing the issue.
- There are many trace file readers available on the Internet, but here are a few common ones that I have seen customers and partners use.
- BareGrep – This is a third party tool with a free version and also a registered version. This works very well if you have several trace files to parse through quickly and do not know which file contains your error. This is very common if you enabled Verbose tracing on a busy production server.
- Trace Reader for Microsoft Dynamics CRM – This is a new trace tool that is supposed to work with CRM 4.0, 2011 and 2013, but I haven’t personally used it yet. However, it was written by tanguy92 who also wrote the Diagnostics Tool for CRM 2011, so I am optimistic this should work well.
- NotePad – Yes, Notepad. It’s simple and built in for quick usage. Turn off Word Wrap (under Format) and just use CTRL+F and search for “Error |” or whatever key word you saw in the error message.
Windows PowerShell is another method that you can use to enable CRM platform tracing when you want to quickly enable tracing for an entire CRM deployment. This can be very effective when you have multiple CRM servers vs. going to each CRM server and enabling tracing via the registry. This topic is also covered in the How to enable platform tracing in Microsoft Dynamics CRM KB article.
When tracing is enabled via PowerShell you should specify a different trace directory location to store the trace files. By default CRM is set to use C:\crmdrop\logs, but since it’s very likely that location does not exist on your CRM servers, you will think that tracing was not enabled correctly as you are looking in the <Install Drive>:\Program Files\Microsoft Dynamics CRM\Trace folder for the trace files. You either have to update the TraceDirectory via PowerShell to that default location which already exists, or create a different location manually and specify that location (ie: D:\CRMTrace) using PowerShell. I recommend this option, so that you do not risk filling up your primary C: drive with CRM trace files.
- When tracing is enabled via PowerShell, but disabled via the registry; tracing will still be enabled as it’s tracing for the Deployment vs. just a single server.
- If tracing is enabled via PowerShell and via the Registry; the Registry will override and the CRM traces will be in the <Install Drive>:\Program Files\Microsoft Dynamics CRM\Trace folder instead of the location you specified via PowerShell.
- If tracing is disabled via PowerShell, but enabled via the registry; then tracing will be enabled on that server with the registry key in place and the traces will be going to the <Install Drive>:\Program Files\Microsoft Dynamics CRM\Trace folder.
So, as you can see the answer to use the registry or PowerShell can depend on the scenario you are troubleshooting, type of environment you have an where you want to store the log files. There is no right or wrong answer, so just use what makes sense for you and your CRM deployment based on the information provided in this blog post.
What about the CRM Outlook client tracing mentioned above? If you were unable to find the error details in the CRM server platform trace and you suspect it’s a client side issue, you can enable CRM platform tracing on the CRM Outlook client machine. Keep in mind that this only applies to the CRM Outlook clients and not the CRM web clients. If you are using CRM through a web browser only, then you would just use server side platform tracing. That’s why the first thing I do when there is an issue with the CRM Outlook client is to try reproduce the issue in the CRM web client to help reduce the complexity of troubleshooting the issue.
You can enable CRM platform tracing on the CRM Outlook client by going to Start, All Programs, Microsoft Dynamics CRM 2011, Diagnostics. If you are using Windows 8 or 8.1, you can simply click the Windows key and start typing: Diagnostics. Then click on the CRM Diagnostics tile. When you are in the CRM Outlook client diagnostics tool, select the Advanced Troubleshooting tab, and then select Tracing to enable or click to clear Tracing to disable and then click Save. After you reproduce the issue, disable tracing and the CRM for Outlook tracing files are located in the C:\Users\<username>\AppData\Local\Microsoft\MSCRM\Traces folder. For additional details on CRM Outlook client tracing, please refer to our documentation on MSDN.
Hopefully this helps to clear up some of the CRM platform tracing questions you have, or may have had at some point while working with CRM platform tracing.
As always our CRM PFE and CRM Support teams are ready to help if you need the assistance. In addition, we have a plethora of other services we offer such as developer training, admin workshops, and code reviews. If you would like to have another Microsoft PFE or I visit your company and assist with the ideas presented on our blog, contact your Microsoft Premier Technical Account Manager (TAM) for booking information. For more information about becoming a Microsoft Premier customer email PremSale@microsoft.com, tell them CRMInTheField or I sent you.
Please share any other helpful tips or tools that you use for CRM platform tracing in the comments below.