Debugging Forms

You can debug forms to see the severity of the issue and use the debugging log to create a SmartForms runtime ticket by following the steps below:

  1. Add an extra query string parameter to the URL of your form: ?_debug=1. This value is the debug level, and you specify a level between one and five, for example, https://denallix.com/Runtime/Runtime/Form/New+Client/?_debug=3.
  2. When you set the debug level to five only error messages display. The frequency of logging decreases as the debug level number increases. The importance of the message increases as the level increases.
    Levels:
    1 = Debug
    2 = Message
    3 = Info
    4 = Warning
    5 = Error
  3. Alternatively, if you need to debug all forms on the server, you can add the debug setting to the runtime site’s web.config as follows:

    You can find the web.config file in the following location:
    "%ProgramFiles%\K2\K2 smartforms Runtime\web.config"
    For information on the configurable settings in the web.config file, see the topic K2 runtime web.config file debugging settings in the Nintex Automation Installation and Configuration Guide.
  4. When you add the debug string to the URL a Show Log button is added to the top right corner of your page. This button shows once a debugging message is logged based on your setting.
  5. Click the Show Log button to display the Logging Information.
  6. There are two toolbar buttons on the Logging Information window:

  7. Rows containing data are marked by an x. When you double click one of these rows you see Debugging Data for the action executed as an example.

  8. Messages are logged to the browser’s console as well. You must open the console before the event fires on the form. Use the following steps to open the console in the different browsers:
    • Internet Explorer /Google Chrome
      1. Press F12
      2. Click the Console tab
    • FireFox
      1. Press F12
      2. Click the Console tab
    • Safari
      1. Press control and comma (ctrl + ,) at the same time
      2. Click the Advanced tab
      3. Check show develop menu in menu bar
      4. Press control alt and c (ctrl + alt + c) at the same time (This is the only step necessary for future use)

      Following is an example of the Console in Google Chrome.
  9. Some browsers open the XML document when you click the Data or Document at the end of the row.

    This is useful if you develop custom controls and need to see what the server was trying to evaluate. You can also get this data in any browser using the steps below.
    1. If you use Firefox's developer tools you need to pause on uncaught exceptions. To turn this on click Debugger and then click the pause button as shown below.
    2. This allows you to break where the exception occurs and have a full expandable call stack that opens the code for the function.
    3. To get the correct stack trace you must change the runtime web.config file to turn off the minifying performance optimizations by changing the UseBundledFiles setting to false. Refresh the browser and recreate the error scenario. The stack trace points to the correct files or line numbers. Remember to change this value back to true once you are finished debugging. You can find the web.config file in the following location:
      "%ProgramFiles%\K2\K2 smartforms Runtime\web.config"

See the article K2 Auditing and Logging framework for more information on the logging framework and auditing features.