Unable to see logs for Azure Function

Anuj Pachawadkar 65 Reputation points
2023-08-18T05:05:34.49+00:00

I have created Azure Function Apps, one with NodeJS runtime and another with Python. When I test/run those functions I am unable to see logs in monitor section since last couple of weeks. Can someone help me for understanding or resolving this problem?
(Monitor only shows the message - Results may be delayed for up to 5 minutes.)
User's image

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,880 questions
{count} votes

Accepted answer
  1. navba-MSFT 23,460 Reputation points Microsoft Employee
    2023-08-21T09:33:50.8233333+00:00

    @Anuj Pachawadkar Welcome to Microsoft Q&A Forum, Thank you for posting your query here!

    I understand that you are facing an issue with Azure Function Apps, where you are unable to see logs in the monitor section when testing or running functions with NodeJS and Python runtimes. The monitor only shows the message Results may be delayed for up to 5 minutes.

    There are multiple ways you can view the Azure Function logs. Please see the below suggestions, you can follow any of the below suggestions, whichever is feasible to you.

    Using Kudu Console:
    The Function logs are written to the log files. You can access these logs from the Kudu console from Azure FunctionApp portal as shown below:

    User's image

    User's image

    **

    Using Logger and also loglevel:**

    Ensure that you have configured the logger as mentioned in this document.
    Also the logLevel is defined in the host.json. So please check within your host.json file which logLevel has been defined.

    "logging": {
        "fileLoggingMode": "always",
        "logLevel": {
            "default": "Information",
            "Host.Results": "Error",
            "Function": "Trace",
            "Host.Aggregator": "Trace"
        }
    }
    
    

    Using Visual Studio Code and the Azure Functions Extension

    From your VS Code, using the Azure Functions Extension) you can try to connect to the log stream of your azure function as shown below:

    enter image description here

    Using func core tools:

    You can use the func azure functionapp logstream command to view the streaming logs of a specific function app running in Azure, as in the following example:

    func azure functionapp logstream <FunctionAppName>

    Using Azure CLI:

    You can enable streaming logs by using Azure PowerShell. For PowerShell, use the Set-AzWebApp command to enable logging on the function app, as shown in the following snippet:

    Set-AzWebApp -RequestTracingEnabled $True -HttpLoggingEnabled $True -DetailedErrorLoggingEnabled $True -ResourceGroupName $ResourceGroupName -Name $AppName

    Using Application Insights

    Please refer to the application insights log of your function app and verify if there is any configuration issue i.e. the storage connection string is not added/configured correctly in your application setting of your function app?

    User's image

    Sharing some of the threads where similar issues were reported:

    https://stackoverflow.com/questions/44657584/azure-function-apps-logs-not-showing

    https://learn.microsoft.com/en-us/answers/questions/1005266/azure-function-not-running-nor-generating-logs

    https://learn.microsoft.com/en-us/answers/questions/1183340/missing-azure-function-logs-what-more-can-influenc

    Hope this helps.


    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.