Geeks With Blogs
Inside Microsoft Dynamics CRM 3.0 Arne Janning

So let's simply start this blog.

One of my goals is to show how one can inject custom code in CRM 3.0 - I'm not talking about callouts or supported and documented stuff (of course I will write about this as well on this blog) - I'm talking about changing the internal objects and data structures at runtime.

To that end we will have to look a lot at the code Reflector gives us, to see what's really going on under the hood. To that same end - and for many other things - using the built-in tracing-mechanism is really useful to see what MSCRM actually does.

Although there is a section "Registry Settings" in the SDK it is not documented how to enable tracing.

But Reflector shows that there is a class called CrmTrace in Microsoft.Crm.dll. The method Microsoft.Crm.CrmTrace.LoadTrace() : Boolean shows the registry keys that are necessary to enable tracing:

private static bool LoadTrace()
{
      string[] textArray2;
     //[...]
     textArray2 = new string[] { "TraceEnabled", "TraceSchedule", "TraceCallStack", "TraceCategories" } ;
     //[...]
     text1 = "TraceEnabled";
     CrmTrace.isTracingOff = ((int) RegistryCache.GetValue("TraceEnabled")) == 0;
     //[...]

 

So to enable the tracing-mechanism you simply have to add some registry keys to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSCRM:

  • TraceEnabled (dword) - set the value to 1 to turn on tracing, set the value to 0 to turn it off again
  • TraceDirectory (string) - this is the directory where the trace files are stored. The directory has to exist, CRM will not create the directory.
  • TraceCategories (string) - set the value to *:Verbose
  • TraceCallStack (dword) - set the value to 1 if your're interested in the stack trace
  • TraceRefresh (dword) - set the value to 1
  • TraceSchedule (string) - set it to one of the values of the Microsoft.Crm.TraceSchedule-enum: e.g. Daily or Hourly

It is not necessary to restart IIS, MSCRM 3.0 has a mechanism of getting notified of configuration-changes at runtime. This mechanism gets started by the Microsoft.Crm.MainApplication.Application_OnStart()-method in Microsoft.Crm.Application.Pages.dll:

NotificationManager.StartNotificationsThread(new Notification());

Microsoft.Crm.MainApplication.Application_OnStart() is the main entrypoint for the whole MSCRM-application. We will speak about this later in much greater detail.

To be continued...

Posted on Wednesday, November 16, 2005 5:24 PM | Back to top


Comments on this post: Enable tracing in Microsoft Dynamics CRM 3.0

# re: Enable tracing in Microsoft Dynamics CRM 3.0
Requesting Gravatar...
Really eager to see the articles on how to inject custom code to MS CRM 3.0. I need to do the same thing but don't have any clue until now. I plan to use some methods (Reflection.Emit, DynamicProxy) used by AOP, but seems not very suit...


Peter
email: peteryin007@gmail.com
Left by peter on Jan 25, 2006 12:50 AM

# re: Enable tracing in Microsoft Dynamics CRM 3.0
Requesting Gravatar...
Really eager to see the articles on how to inject custom code to MS CRM 3.0. I need to do the same thing but don't have any clue until now. I plan to use some methods (Reflection.Emit, DynamicProxy) used by AOP, but seems not very suit...


Peter
email: peteryin007@gmail.com
Left by peter on Jan 25, 2006 12:56 AM

# re: Enable tracing in Microsoft Dynamics CRM 3.0
Requesting Gravatar...
Hi,

I am in neeed of extending the MS CRM 3.0 customizations beyond what is provided in SDK

if you could help me with more sample codes for directly customizing the platform it would be of great help to me

Thanks,
Soumya
Left by soumya on Jan 17, 2008 3:28 AM

# re: Enable tracing in Microsoft Dynamics CRM 3.0
Requesting Gravatar...
nice article, you saved my time. thanks.
Left by CRM Developer on Jun 05, 2008 11:59 PM

# re: Enable tracing in Microsoft Dynamics CRM 3.0
Requesting Gravatar...
I need to do the same thing but don't have any clue until no,I am in neeed of extending the MS tn requin pas cher
CRM 3.0 customizations beyond what is provided in SDK
Left by jinhau on Jan 07, 2012 9:25 AM

Your comment:
 (will show your gravatar)


Copyright © Arne Janning | Powered by: GeeksWithBlogs.net