Question Status

Verified
Gary DiGirolamo asked a question on 23 Jan 2015 9:11 AM

I have some custom logging in my plugin and want to include the contents of my tracingService in my custom logging (which writes to my log within catch blocks, before the plugin finishes).

I cant seem to access the content of tracingService. I wonder if it is accessible at all?

I tried tracingService.ToString() just incase the devs had provided a useful overload, alas as expected I get name of the class "Microsoft.Crm.Sandbox.SandboxTracingService".

So far....

To get the traceInfo string from traceService at runtime I used debugger to interrogate the tracingService contents and extract the expression.

So the traceInfo string is accessible from these expressions...

for Plugins

((Microsoft.Crm.Extensibility.PipelineTracingService)(tracingService)).TraceInfo

for CWA

((Microsoft.Crm.Workflow.WorkflowTracingService)(tracingService)).TraceInfo


However, at design time neither of these expressions seem to be accessible from any of the standard CRM 2011 SDK dlls...


Any ideas community?!

TIA

Reply
Gary DiGirolamo responded on 23 Jan 2015 9:15 AM

I noticed that Microsoft.Crm.Extensibility & Microsoft.Crm.Workflow are dlls found on the server, so as a little experiment, i referenced them in my code and tried to make the expressions above compile.

Alas even with these references, the required class doesnt seem to exist (atleast on the dlls I had on my server).  ie PipelineTracingService & WorkflowTracingService

Reply
Verified Answer
Ben Hosking responded on 23 Jan 2015 9:42 AM

I have never heard of anyone getting the tracing contents

I also can't see any methods or way to get the tracing content

The only solution I can think of is is to extend the tracing class and log the tracing calls elsewhere (where you can get at them) and trace them as normal.

I mocked a tracing object for testing in this blog

crmbusiness.wordpress.com/.../crm-20112013-using-itracingservicing-and-mocking-it-up

hopefully the bump on this question may bring someone with a better suggestion

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply
Gary DiGirolamo responded on 23 Jan 2015 9:44 AM

Thanks ben,

Yeah was hoping to not have to wrap the tracing object but its looking likely.

The data is so tantalizingly close as i can access it with debugger at runtime, but not via code prepared at design time!

Cheers,

Gary

Reply
Ben Hosking responded on 23 Jan 2015 10:38 AM

I got this as a potential answer on twitter from the knowledgable Simon Jenkinson https://twitter.com/simonjen1

looks like theres a class in Microsoft.Crm.Core.dll called CrmTrace & method called StackTraceToString, might be possible with that

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply
Verified Answer
Ben Hosking responded on 23 Jan 2015 9:42 AM

I have never heard of anyone getting the tracing contents

I also can't see any methods or way to get the tracing content

The only solution I can think of is is to extend the tracing class and log the tracing calls elsewhere (where you can get at them) and trace them as normal.

I mocked a tracing object for testing in this blog

crmbusiness.wordpress.com/.../crm-20112013-using-itracingservicing-and-mocking-it-up

hopefully the bump on this question may bring someone with a better suggestion

Ben  Hosking

If the my post helped you please mark my post as the suggested answer

Hosk's Dynamic CRM Blog   |  @BenHosk |  Rockstar365

Hosks CRM Dev YouTube Channel

Reply