Debugging Azure static web sites with Python Azure functions for api

kanna 106 Reputation points
2022-02-01T05:23:29.003+00:00

I'm trying to debug Azure Static web site with api written in Python Azure function. How can I look at logging.info logging.warn messages?

I'm unsuccessful in setting up local dev environment, I would like to look at debug/info messages from Python functions. As it using AD for auth I don't think it is easy to set up local environment.

I would like to view the log messages from azure functions from the static website deployment.
Is it possible to capture and view them in portal?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
1,173 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-02-02T12:53:23.5+00:00

    @kanna , If you are using the logging.info as mentioned here, you should see the logs in the streaming console. Otherwise you should see the logs in the monitor section under the specific function. You can select one of the invocations and it will show the logs.

    Modify your host.json file like below and test again

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

    reference : https://learn.microsoft.com/en-us/azure/azure-functions/configure-monitoring?tabs=v2#configure-log-levels

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


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.