HowTo: Troubleshoot Azure functions

Official Content

After having published an Azure Function, if it's not working, you can troubleshoot in many ways.

To have complete telemetry information and logs in any platform, you shoud check HowTo: Monitoring Azure Functions

Below are some tips to troubleshoot Azure Functions.

Tip #1 Accessing the Function App monitor menu option

Access the Azure portal and select your function.

image_20201210161443_1_png

image_20201210162351_1_png

Click on the Monitor option on the left hand side:

image_20201210162450_1_png

There you can see all the invocations (successful or not) of the function.

image_20201210162552_1_png

And check the invocation details (if any error is thrown, it will be shown in this panel).

image_20201210162652_1_png

The logging information can be seen using the Logs tab in the Monitor panel.

image_20201210162817_1_png

Consider that the host.json file can be modified to control the logging behavior. See the Azure documentation to know how to set the host.json file.

Tip #2 Accesing Diagnostic tools

There are also Diagnostic tools like the "Diagnose and solve problems" menu option of the Function App.

There you can choose "Functions that are not triggering" for example, and get an explanation of the problem.

image_202112916411_1_png

Tip #3 Accessing the logs saved in the storage

In the case of Windows platform you can easily access the logs in the storage of the Function App.

To check the logs generated under the Storage account of the function, you can go through the Function Resource Group properties to get the storage account link:

image_2021111205119_1_png

At the storage acount you can view the File Shares, and under a tree structure you have the LogFiles.

image_2021111204846_1_png

The Kudu Application can be very helpful also, it can be accesed in a URL like the following:

https://<FunctionAppName>.scm.azurewebsites.net/DebugConsole

To get the generator trace from the storage (only Windows), you have to configure the Logging section of the generator. Note that the directory of the Azure function is read-only.
Also, you have to save the file in another directory of the structure, as shown in the following figure:

image_2021101291131_1_png

Check the Storage Account of the Azure Function under File Shares to see where to store the log file and to be able to download it.

image_202110129138_1_png

Note that the Kudu Application can be helpful to know the path where to save the log file.

See also

Azure App Services diagnostics overview