Share via


How to enable workflow tracing (debug)

This might come in handy whenever you (like myself and I am sure thousands of others) see some error in the execution of one workflow and found the completely useless messages like “Error Occurred”

Dig deep and find nothing

first troubleshooting step would be to enable verbose logging on the workflows category and check the SharePoint logs.

If this does not provide you with a clue on what might be going on, you can try the following thing:

Add the following code to the web.config of the site where the workflow is located after this key :

</System.Workflow.ComponentModel.WorkflowCompiler>

-----------------------------------------------------

  <system.diagnostics>

      <switches>

          <add name="System.Workflow LogToFile" 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>

-----------------------------------------------------

and before this key

<appSettings>

Try to start the workflow.

You should get a debug-level log file created on c:\windows\system32\inetsrv, workflowtrace.log

Additionally, it might happen that sometimes the workflowtrace.log file is  not created automatically ( maybe some permission issues that I didn’t bother to investigate). Just create the file by hand and start the workflow.

You should have all the information you need to troubleshoot the issue in the file.

Cheers

 

Official content published here :https://support.microsoft.com/kb/972914

 

With the help of my colleague Stephan Luth ,some ammendments:

    <sharedListeners>

      <add name="System.Workflow"

           type="System.Diagnostics.TextWriterTraceListener"

           initializeData="d:\_temp\WFTrace.log"

           traceOutputOptions="DateTime,ProcessId"/>

    </sharedListeners>

 

In this way you will get a timestamp, which will allows you to map ULS logs with the workflow logs.

 

Additionally you should enable workflow logging for OWSTIMER.EXE, because some part of workflow will be executed in this process:

 

(a) Create a text file “OWSTIMER.EXE.config” with notepad with following content (change the target file(yellow marked) to a file/path what you prefers):

<?xml version="1.0" encoding="utf-8"?>

<configuration>

  <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="d:\_temp\WFTrace.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>

</configuration>

(b) Save the file in the folder
C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin
(This is the directory, which contains the file OWSTIMER.EXE)

(c) Open a console prompt window and execute following command lines:
net stop sptimerv3
net start sptimerv3

(d) Do the steps (a) to (c) on every WFE.

 https://support.microsoft.com/kb/947285

Comments

  • Anonymous
    March 05, 2009
    Great post, Victor! This definitely comes in useful when the ULS or other data aren't shedding any light on the situation.

  • Anonymous
    February 03, 2012
    The comment has been removed

  • Anonymous
    May 16, 2013
    Awesome blog, very helpful Thanks

  • Anonymous
    January 20, 2015
    Thanks for the blog ... Very useful solution Victor ..

  • Anonymous
    May 29, 2016
    I’ll immediately grasp your rss feed as I can not find your emailsubscription link or e-newsletter service. Do you have any?Please allow me know so surveys that pay cash Imay subscribe. Thanks.

  • Anonymous
    June 19, 2016
    Helpful information. Fortunate me I found your website by chance, and I am surprised why this accident didn’t happened in advance! I bookmarked it.

  • Anonymous
    March 15, 2018
    That's useful.Thanks Victor.