How to enable trace logging in Microsoft CRM 2011


Hello again CRM fans. I’m tearing through a bunch of client code upgrades from the old CRM to the new 2011 stuff. In the process, I’m taking notes on what is different and what is the same. Fortunately enabling tracing is just the same as it was in CRM 4.0, but since there don’t seem to be any articles out there that validate this, I’m posting it here.

In case you didn’t know already, there are a few registry keys that control the behavior of the CRM trace log file. Here is the MSDN article that describes the different registry keys involved.

If you are in a hurry, there are only three keys that you really need: one to specify the file name, and two flags to actually enable tracing.


Here is a screenshot to help you out:


5 Responses to “How to enable trace logging in Microsoft CRM 2011”

  1. 1 Hooman

    Thanks for the article, Looking at CRM RC 2011 version, the keys has not been specified in HKEY_LOCAL_MACHINE -> Software -> Microsoft -> MSCRM any ideas?

  2. 2 newcome

    @hooman – just create the needed keys including the parent keys, as they won’t be there by default.

  3. 3 kabbourat

    thanks for the article, I can’t trace my custo messages in he files even using the Itrasincservice.Trace(” here is my messages “);

    when i Search for the string in the log files I can’t find it !!

    there’s any ideas ?

  4. @ kabbourat
    Tracingservice is only written when an exception is thrown.

    A simple way to enable tracing is using the diag tool.

  5. 5 timo pakkala

    Any idea why do I keep getting this error?

    CrmTrace encountered an error. Additional Info:Error in LoadLocalServerRegistrySettings [Unable to cast object of type ‘System.String[]’ to type ‘System.String’.], Stack Trace : at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
    at System.Environment.get_StackTrace()
    at Microsoft.Crm.CrmTraceSettings.Load(String traceDirectory)
    at Microsoft.Crm.CrmTrace.get_RefreshTrace()
    at Microsoft.Crm.CrmTrace.Write(Guid orgId, TraceCategory traceCategory, TraceLevel traceLevel, Int32 skipFrames, String format, Object[] args)
    at Microsoft.Crm.CrmTrace.TraceFormat(Guid orgId, TraceCategory traceCategory, TraceLevel traceLevel, String format, Object[] args)
    at Microsoft.Crm.Sandbox.SandboxWorkerMain.Main(String[] arguments) (Reporting Process:Microsoft.Crm.Sandbox.WorkerProcess, AppDomain:C:\Program Files\Microsoft Dynamics CRM\Server\bin\)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: