Jump to content

Featured Replies

Posted

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.

 

[HEADING=2] [/HEADING]

[HEADING=2]Detecting Script Issues[/HEADING]

 

 

 

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.

[HEADING=2] [/HEADING]

[HEADING=2]How to Use Log Stream[/HEADING]

 

 

 

  • In the designer, click on "Log Stream" from the top panel.
     
    [ATTACH type=full" alt="shahparth_2-1723679683816.png]62797[/ATTACH]
     
     
     
  • Enable Application Insights in your workflow designer by selecting "Configure".
    [ATTACH type=full" alt="shahparth_0-1723679564300.png]62798[/ATTACH]
     
     
     
  • Turn on application insights and pick an already existing instance or create new
     
    [ATTACH type=full" alt="shahparth_1-1723679617015.png]62799[/ATTACH]
     
     
     
  • 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.

[HEADING=2] [/HEADING]

[HEADING=2]Script Error Examples[/HEADING]

 

 

 

  • Syntax Errors: Omitting a semi-colon or other syntax mistakes will display an error in the Log Stream when you save.
     
    [ATTACH type=full" alt="shahparth_3-1723679772586.png]62800[/ATTACH]
     
     
  • Compilation Errors: Issues like missing return statements
    [ATTACH type=full" alt="shahparth_4-1723679793738.png]62801[/ATTACH]
     
     
    or incorrect method names will be flagged once saved.
    [ATTACH type=full" alt="shahparth_5-1723679828754.png]62802[/ATTACH]

 

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.

 

[HEADING=2] [/HEADING]

[HEADING=2]Conclusion[/HEADING]

 

 

 

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...