本文介绍了WF4 中的跟踪不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在尝试设置一个简单的测试用例,用于在 WF4 中推送到 TraceListener.我创建了一个空的 wcf 服务库应用程序(只是默认的获取/回复 xamlx)并将以下内容添加到配置中.我没有重新登录.还需要什么吗?

I'm trying to set up a simple test case of pushing to a TraceListener in WF4. I've created an empty wcf service library app (just the default get/reply xamlx) and added the below to the config. I get no logging back. Is there something else required?

<system.diagnostics>
    <sources>
      <source name="System.Workflow">
        <listeners>
          <add name="System.Workflow" />
        </listeners>
      </source>
      <source name="System.Workflow.Runtime">
        <listeners>
          <add name="System.Workflow" />
        </listeners>
      </source>
      <source name="System.Workflow.Runtime.Hosting">
        <listeners>
          <add name="System.Workflow" />
        </listeners>
      </source>
      <source name="System.Workflow.Runtime.Tracking">
        <listeners>
          <add name="System.Workflow" />
        </listeners>
      </source>
      <source name="System.Workflow.Activities">
        <listeners>
          <add name="System.Workflow" />
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="System.Workflow"
         type="System.Diagnostics.TextWriterTraceListener"
         initializeData="c:\System.Workflow.trace.log"
         traceOutputOptions="DateTime" />
    </sharedListeners>
    <switches>
      <add name="System.Workflow.Runtime" value="Verbose" />
      <add name="System.Workflow.Runtime.Hosting" value="Verbose" />
      <add name="System.Workflow.Runtime.Tracking" value="Verbose" />
      <add name="System.Workflow.Activities" value="Verbose" />
      <add name="System.Workflow.Activities.Rules" value="Verbose" />
    </switches>
  </system.diagnostics>

推荐答案

这应该有效:

<system.diagnostics>
        <sources>
            <source name="System.Activities" switchValue="Verbose">
                <listeners>
                    <add name="textListener" />
                </listeners>
            </source>
        </sources>
        <sharedListeners>
           <add name="textListener"
                type="System.Diagnostics.TextWriterTraceListener"
                initializeData="E:\WORK\POC\MyTraceLog.txt"
                traceOutputOptions="ProcessId, DateTime" />
        </sharedListeners>
        <trace autoflush="true" indentsize="4">
            <listeners>
                <add name="textListener" />
            </listeners>
        </trace>
    </system.diagnostics>

这篇关于WF4 中的跟踪不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-09 02:34