Soru

Zorluk: Çok zorDiagnose and Log App Service Web Apps

You are troubleshooting a startup failure in an ASP.NET Core web application deployed to a Linux Azure App Service. The application fails to initialize, and you need to capture container startup logs to identify the error. You decide to use the Azure CLI to enable container logging, trigger a container restart to generate fresh telemetry under the new configuration, stream the startup log sequence in real time, and download the log zip archive for offline analysis.

Arrange the steps in the correct order to configure, capture, and retrieve these logs.

  1. 1Run `az webapp log config --name myApp --resource-group myRG --docker-container-logging filesystem` to configure logging.
  2. 2Run `az webapp restart --name myApp --resource-group myRG` to restart the web application.
  3. 3Run `az webapp log tail --name myApp --resource-group myRG` to initiate log streaming.
  4. 4Run `az webapp log download --name myApp --resource-group myRG` to retrieve the log archive.

Cevap

To properly diagnose the startup failure, first configure container filesystem logging, restart the application to trigger a fresh initialization attempt, stream the live stdout/stderr streams to observe the failure in real time, and then download the persistent log archive for detailed offline analysis.
The correct order follows a logical pipeline: first, configure the logging infrastructure to persist docker container logs on the file system; second, restart the application to trigger a new container initialization attempt under the active log configuration; third, open a real-time stream to observe stderr/stdout streams during the startup cycle; and fourth, download the full Kudu log archive to get detailed system-level files for offline debugging.

Adım Adım Çözüm

1
Enable container filesystem logging using `az webapp log config` with the `--docker-container-logging filesystem` parameter.
The App Service is configured to write container logs to the local file system.
By default, container stdout and stderr streams are not persisted or streamed for Linux apps unless container logging is explicitly enabled.
2
Restart the application using `az webapp restart`.
The Docker container hosting the web application is terminated and a new container instance starts up.
Restarting the application generates fresh startup telemetry under the newly enabled container logging configuration.
3
Start log streaming using `az webapp log tail`.
A live connection is established to the App Service log stream.
Streaming the logs in real time allows you to observe container initialization issues and runtime crashes as they happen.
4
Download the log archive using `az webapp log download`.
A ZIP archive containing container and system logs is saved locally.
Downloading the complete log package provides Kudu deployment history and host logs that may not be fully visible in the live stream.

Anahtar Kavram

Azure App Service container diagnostics, log configuration, real-time log streaming, and download logs via Azure CLI.
Tahmini Süre:3m 0s
Bu soruyu puanla