Question

Difficulty: MediumDiagnose and Log App Service Web Apps

You are troubleshooting a Python web application deployed on a Linux-based Azure App Service named my-app in a resource group named my-rg. The application fails during the startup phase, and you need to enable container stdout/stderr logging to the filesystem and then view the live log stream in your local terminal. Which two of the following Azure CLI commands must you run?

  1. az webapp log config --name my-app --resource-group my-rg --docker-container-logging filesystemAnswer
  2. az webapp log tail --name my-app --resource-group my-rgAnswer
  3. C
    az webapp log config --name my-app --resource-group my-rg --application-logging true
  4. D
    az webapp log download --name my-app --resource-group my-rg

Answer

Enable container filesystem logging using the command with the --docker-container-logging filesystem flag, and stream the logs using the tail command.
To troubleshoot startup errors on a Linux-based App Service, you must configure container logging to the filesystem using the --docker-container-logging parameter and then use the log tail command to establish a live diagnostic connection.

Step-by-Step Solution

1
Enable container-level filesystem logging using the Azure CLI command.
The App Service is configured to persist stdout and stderr logs within the host filesystem.
On Linux App Services, application logs correspond to the container's standard output and error streams, which must be enabled via the docker-container-logging parameter.
2
Start a live log streaming session using the Azure CLI tail command.
A real-time connection to the App Service log stream is opened in the terminal.
This allows you to observe the startup errors interactively as the container attempts to initialize.

Key Concept

Configuring container logging and streaming logs for Linux-based App Services using the Azure CLI.
Rate this question