Saturday, October 11, 2014

#SharePoint | Enabling Workflow Trace Logs

Problem:
Even though we may have changed customerrors to off in the various web.config files:
  • wwwroot
  • template\admin
  • template\layouts
We may still get pages like these, specially after the workflow starter page, IniWrkflIP.aspx.



Solution:
This article has a great step-by-step tutorial on how to enable debugging of workflows in SharePoint 2007.
However, this wasn't working for me, so after a few trial-and-error, I managed to get it to work simply by pasting the below in the web.config of the web application.

The .log document is created, but only when a workflow starts.
Apparently, if for some reason the workflow fails to start, nothing is ever logged.

  <!-- enable workflow tracing -->
  <system.diagnostics>
    <sources>
      <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.Activities">
        <listeners>
          <add name="System.Workflow"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add name="System.Workflow"
           type="System.Diagnostics.TextWriterTraceListener"
           initializeData="c:\\temp\\WFTrace-w3wp.log"
           traceOutputOptions="DateTime,ProcessId"/>
    </sharedListeners>
    <switches>
      <add name="System.Workflow.LogToTraceListeners" value="1"/>
      <add name="System.Workflow.Runtime" value="All" />
      <add name="System.Workflow.Runtime.Hosting" value="All" />
      <add name="System.Workflow.Runtime.Tracking" value="All" />
      <add name="System.Workflow.Activities" value="All" />
      <add name="System.Workflow.Activities.Rules" value="All" />
    </switches>
  </system.diagnostics>

Source:
How to enable logging information for several Windows Workflow Foundation namespaces

No comments:

Post a Comment