Identify scripting errors using Log Stream in workflow designer

  • Thread starter Thread starter shahparth
  • Start date Start date
S

shahparth

With the introduction of PowerShell and C# scripting capabilities, we have made it easier to identify errors during development and compile time. The Log Stream feature in Logic Apps, powered by Application Insights, helps you catch syntax and compilation errors in real-time, directly within the designer.

Detecting Script Issues​




Log Stream can identify any issues with your scripts. Here’s how:

  1. Configure Application Insights: If not already set up, you'll be prompted to configure it when accessing "Log Stream."
  2. Author and Test Your Scripts: Use Log Stream to spot compilation or syntax errors as you build your PowerShell or C# scripts.

How to Use Log Stream​




  • In the designer, click on "Log Stream" from the top panel.

    shahparth_2-1723679683816.png


  • Enable Application Insights in your workflow designer by selecting "Configure".
    shahparth_0-1723679564300.png


  • Turn on application insights and pick an already existing instance or create new

    shahparth_1-1723679617015.png


  • Once set up, open Log Stream from the top panel, and switch from "App Insights Logs" to "Filesystem Logs."
  • Set the Log Level to “Error” to track issues as you work.

Script Error Examples​




  • Syntax Errors: Omitting a semi-colon or other syntax mistakes will display an error in the Log Stream when you save.

    shahparth_3-1723679772586.png

  • Compilation Errors: Issues like missing return statements
    shahparth_4-1723679793738.png


    or incorrect method names will be flagged once saved.
    shahparth_5-1723679828754.png

Note that workflow has to be saved in order for errors to appear after editing the script. Errors will not appear if you do not save.

Conclusion​




Log Stream and Application Insights make it easy to catch and fix errors early, ensuring smooth and reliable workflows. Let us know your thoughts in the comments and if you'd like to see any improvements to this solution.

Continue reading...
 
Back
Top