问题描述
我已针对CRM 2013编写了自定义工作流程活动。您无需了解它的作用。我的问题是,尽管实例化了 ITracingService
,但是我使用 Trace(...)
方法在运行时仅适用于实时工作流。换句话说,如果我异步运行我的工作流并(故意)抛出异常,那么我将在相应的系统作业记录中看到跟踪日志。如果我只是将工作流程切换为实时(同步),那么我仍然会遇到异常,并且仍然会收到任何自定义的 exception 文本,但是当然没有相应的 systemjob
是为实时工作流生成的,因此,像一个插件一样,我正在可下载的日志文件中查找我的Trace输出,该日志文件在发生异常时显示。在这种情况下,跟踪不可见,但从(可能是)托管工作流的父上下文中获得了Microsoft的跟踪日志-您可以看到它正在引用我的工作流过程定义中的步骤:
I've written a custom workflow activity against CRM 2013. You don't need to understand what it does. The problem I have is that despite instantiating the ITracingService
, any tracing content that I generate using the Trace(...)
method is obfuscated at runtime for real-time workflows only. In other words, if I run my workflow asynchronously and (deliberately) throw an Exception, I get to see the trace log in the corresponding system job record. If I simply switch the workflow to be "real-time" (synchronous) then I still get an exception and I still get any custom exception text, but of course there is no corresponding systemjob
generated for realtime workflows so, like a plug-in, I am seeking my Trace output in the downloadable log file that is presented when an exception occurs. In this case, my Traces are not visible but I get what appears to be Microsoft's trace log from (perhaps) the parent context that hosts the workflow - you can see that it is referencing the steps in my workflow process definition:
[Microsoft.Crm.ObjectModel: Microsoft.Crm.Extensibility.InternalOperationPlugin]
[46f6cf4c-14ae-4f1e-98a1-eae99a37e95c: ExecuteWorkflow]
Starting sync workflow 'MyTestWorkflow', Id: ca8782b1-7ca4-e311-a055-6c3be5be5f78
Entering CreateStep1_step:
Entering CustomActivityStep2_step:
Sync workflow '__Test' terminated with error 'Unexpected exception from plug-in (Execute): My.Test.WF.DoSomething: System.NullReferenceException: Object reference not set to an instance of an object.'
在我的程序集中 My.Test.WF.DoSomething
我在调用时访问跟踪服务,并立即开始通过 Trace()
方法,例如
In my assembly My.Test.WF.DoSomething
I access the Tracing Service at invocation and immediately start writing via the Trace()
method, e.g.
_trace.Trace("Starting Greg's custom code...");
这只是一个例子,但要点是,我的跟踪在异步时有效,但丢失了
This is only an example, but the point is, my tracing works when asynchronous but is "lost" when synchronous.
有什么想法吗?
推荐答案
进程会话部分在相应的工作流设计器表单上,包含完整的异常消息。
The process sessions section on the corresponding workflow designer form contains the full exception message.
这篇关于实时工作流的自定义工作流活动中缺少跟踪日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!