Soru

Zorluk: OrtaDiagnose and Log App Service Web Apps

A web application running in a Linux-based Azure App Service environment within resource group `rg1` is failing to start up. To diagnose the initialization error, you want to inspect the output sent to standard output (stdout) and standard error (stderr) by enabling local filesystem logging.

Which Azure CLI command should you execute to enable this diagnostic log collection for the app named `webapp1`?

  1. az webapp log config --name webapp1 --resource-group rg1 --docker-container-logging filesystemCevap
  2. B
    az webapp log config --name webapp1 --resource-group rg1 --application-logging true
  3. C
    Add the Application Insights SDK to your application and execute the startup sequence without specifying a Connection String, expecting App Service to automatically route stdout/stderr to Azure Monitor.
  4. D
    Create an App Configuration key named log-path and set its value using the @Microsoft.KeyVault(SecretUri=...) syntax to point to the App Service log folder.

Cevap

Execute the command `az webapp log config --name webapp1 --resource-group rg1 --docker-container-logging filesystem` to enable container logging.
The correct command uses `--docker-container-logging filesystem` which enables the collection of standard output and standard error streams from the Docker container hosting the Linux App Service application, saving them to the local filesystem.

Adım Adım Çözüm

1
Identify the App Service operating system (Linux) and the type of logs needed (stdout/stderr console output).
Determine that for Linux-based App Services, console streams are captured via container logging rather than traditional application logging.
Linux App Services run applications inside Docker containers, where standard output and standard error are written to the container log files.
2
Select the correct Azure CLI parameter to enable container logging on the filesystem.
Identify `--docker-container-logging filesystem` as the correct parameter.
This parameter configures the App Service to save container stdout/stderr logs directly to the local filesystem for retrieval.

Anahtar Kavram

Configuring container logging on Linux-based Azure App Services to capture console output.
Tahmini Süre:1m 30s
Bu soruyu puanla