Workflow REST API and OData API Logging

You can enable logging for the Workflow REST API and the OData API to troubleshoot issues you may have when using either API.

For more information on the Workflow REST API see these topics:

For information on the OData API see these topics:

API logging is disabled by default. You should only enable API logging to troubleshoot an issue you are having, then disable it to avoid performance degradation. Enable logging and configure the logging level by editing the Web.config file located at:

Workflow REST API

[Program Files]\K2\WebServices\API\Workflow\V1\Web.config

Note: The V1 part of the path above represents the version of the API. The value might be different depending on the version of the workflow API you are using. At the release of the product the versions available were V1 and Preview.

OData API [Program Files]\K2\WebServices\API\SmartObjectService.OData\Web.config

It's recommended that you restart the IIS server using the iisreset command, and restart the products Server service after you have made changes to config files.

Steps to enable and configure API logging:

  1. Open the appropriate Web.config file in a text editor and search for the DevLogTraceListener item in the <system.diagnostics><trace><listeners> section. The line will be slightly different depending on which API Web.config file you open.
    Copy

    Listeners section of the web.config

    <system.diagnostics>
          <trace autoflush="true">
            <listeners>
              <add name="DevLogTraceListener" type="System.Diagnostics.TextWriterTraceListener, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" initializeData="C:\Program Files\K2\WebServices\API\Logs\WorkflowServiceTraceV1.log" traceOutputOptions="Timestamp">
                <!--
    Available filter initialization values are: "All", "Error", "Warning", "Verbose", or "Off"
    For more info see https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.sourcelevels
    -->
                <filter type="System.Diagnostics.EventTypeFilter" initializeData="Off" />
              </add>
              <remove name="DevLogTraceListener">
                <!-- Remove this block to enable tracing. It's here to ensure that tracing is disabled by default. -->
              </remove>
            </listeners>
          </trace>
    </system.diagnostics>
  2. Disable the <remove> tags by putting the <remove>...</remove> section inside a comment tag (<!-- -->) as shown below.
    Copy

    Remove tags

    <!-- <remove name="DevLogTraceListener"> -->

      <!-- Remove this block to enable tracing. It's here to ensure that tracing is disabled by default. -->

    <!-- </remove> -->
    Change the initializeData property of the filter tag to set the level of logging you want (All, Error, Warning, Verbose, or Off). For more info on the diagnostic levels available, see this Microsoft article.
    <filter type="System.Diagnostics.EventTypeFilter" initializeData="All" />
  3. Save the Web.config file
  4. Reproduce the error that you are troubleshooting
  5. Navigate to [Program Files]\K2\WebServices\API\Logs and open relevant the log file. The log file may contain information that will help you troubleshoot the error
  6. When you are done troubleshooting, remove/disable the API logging by removing the comment tags that you entered in step 2 and change initializeData from step 3 back to Off
    Copy

    Tidy up

        <filter type="System.Diagnostics.EventTypeFilter" initializeData="Off" />
    </add>
    <remove name="DevLogTraceListener">
        <!-- Remove this block to enable tracing. It's here to ensure that tracing is disabled by default. -->
    </remove>