Question

Difficulty: MediumDiagnose and Log App Service Web Apps

You are troubleshooting a startup failure for a web application hosted on a Linux-based Azure App Service. You need to enable container logging, view the logs in real-time to identify the exception, and minimize administrative overhead. Move the actions from the list of actions to the answer area and arrange them in the correct order.

  1. 1Run the az webapp log config command with the --docker-container-logging filesystem parameter.
  2. 2Run the az webapp log tail command.
  3. 3Access the web application URL in a web browser or send an HTTP request to the endpoint.
  4. 4Review the streaming stdout and stderr console output in the CLI terminal.

Answer

First, run the az webapp log config command with the --docker-container-logging filesystem parameter. Second, run the az webapp log tail command. Third, access the web application URL. Fourth, review the streaming stdout and stderr console output in the CLI terminal.
To diagnose a startup failure on a Linux App Service, you must first enable container logging by running the command with the filesystem parameter. Once enabled, starting the log stream with the tail command ensures you can capture live output. Accessing the web application triggers the startup or request cycle, producing log entries that are then piped directly to the console for analysis.

Step-by-Step Solution

1
Enable container logging to the filesystem.
Container logging is activated, instructing the Linux App Service to write stdout and stderr to the filesystem.
By default, container logging is disabled. You must enable it using the az webapp log config command with the --docker-container-logging parameter set to filesystem before you can stream the logs.
2
Initiate the log streaming session.
A persistent connection is established to the App Service log streaming endpoint.
Running the az webapp log tail command starts a live stream session in your terminal, which will capture and print logs in real-time as they are written.
3
Trigger the failure.
The App Service container attempts to initialize or process the incoming web request, generating diagnostic events.
Since the stream is live, generating a new request ensures that the startup or runtime error is immediately logged and streamed to the active CLI session.
4
Review the log stream output.
The exact exception details, stack traces, or console outputs are displayed in the CLI terminal.
Analyzing the stdout/stderr streaming output allows you to inspect the exception details and trace the root cause of the startup failure.

Key Concept

Configuring container logging and streaming logs in real-time using Azure CLI for Linux Azure App Service.
Rate this question