Skip to content

Commit c04f1c1

Browse files
Merge pull request #285214 from v-albemi/app-service-freshness-2
Freshness - Azure App Service
2 parents 6731381 + b1bb173 commit c04f1c1

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

articles/app-service/troubleshoot-diagnostic-logs.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Enable diagnostics logging
33
description: Learn how to enable diagnostic logging and add instrumentation to your application, as well as how to access the information logged by Azure.
44
ms.assetid: c9da27b2-47d4-4c33-a3cb-1819955ee43b
55
ms.topic: article
6-
ms.date: 06/29/2023
6+
ms.date: 08/21/2024
77
ms.author: msangapu
88
author: msangapu-msft
99
ms.custom: devx-track-csharp, ai-video-demo, linux-related-content
@@ -25,23 +25,23 @@ Azure provides built-in diagnostics to assist with debugging an [App Service app
2525
This article uses the [Azure portal](https://portal.azure.com) and Azure CLI to work with diagnostic logs. For information on working with diagnostic logs using Visual Studio, see [Troubleshooting Azure in Visual Studio](troubleshoot-dotnet-visual-studio.md).
2626

2727
> [!NOTE]
28-
> In addition to the logging instructions in this article, there's new, integrated logging capability with Azure Monitoring. You'll find more on this capability in the [Send logs to Azure Monitor](#send-logs-to-azure-monitor) section.
28+
> In addition to the logging instructions in this article, you can also use the Azure Monitor integrated logging capability. You'll find more on this capability in the [Send logs to Azure Monitor](#send-logs-to-azure-monitor) section.
2929
>
3030
31-
|Type|Platform|Location|Description|
31+
|Type|Platform|Log storage location|Description|
3232
|-|-|-|-|
3333
| Application logging | Windows, Linux | App Service file system and/or Azure Storage blobs | Logs messages generated by your application code. The messages can be generated by the web framework you choose, or from your application code directly using the standard logging pattern of your language. Each message is assigned one of the following categories: **Critical**, **Error**, **Warning**, **Info**, **Debug**, and **Trace**. You can select how verbose you want the logging to be by setting the severity level when you enable application logging.|
3434
| Web server logging| Windows | App Service file system or Azure Storage blobs| Raw HTTP request data in the [W3C extended log file format](/windows/desktop/Http/w3c-logging). Each log message includes data such as the HTTP method, resource URI, client IP, client port, user agent, response code, and so on. |
35-
| Detailed Error Messages| Windows | App Service file system | Copies of the *.htm* error pages that would have been sent to the client browser. For security reasons, detailed error pages shouldn't be sent to clients in production, but App Service can save the error page each time an application error occurs that has HTTP code 400 or greater. The page may contain information that can help determine why the server returns the error code. |
36-
| Failed request tracing | Windows | App Service file system | Detailed tracing information on failed requests, including a trace of the IIS components used to process the request and the time taken in each component. It's useful if you want to improve site performance or isolate a specific HTTP error. One folder is generated for each failed request, which contains the XML log file, and the XSL stylesheet to view the log file with. |
35+
| Detailed Error Messages| Windows | App Service file system | Copies of the *.htm* error pages that would have been sent to the client browser. For security reasons, detailed error pages shouldn't be sent to clients in production, but App Service can save the error page each time an application error occurs that has HTTP code 400 or higher. The page may contain information that can help determine why the server returns the error code. |
36+
| Failed request tracing | Windows | App Service file system | Detailed tracing information on failed requests, including a trace of the IIS components used to process the request and the time taken in each component. This information is useful if you want to improve site performance or isolate a specific HTTP error. One folder is generated for each failed request. The folder contains the XML log file and the XSL stylesheet to view the log file with. |
3737
| Deployment logging | Windows, Linux | App Service file system | Logs for when you publish content to an app. Deployment logging happens automatically and there are no configurable settings for deployment logging. It helps you determine why a deployment failed. For example, if you use a [custom deployment script](https://github.com/projectkudu/kudu/wiki/Custom-Deployment-Script), you might use deployment logging to determine why the script is failing. |
3838

3939
When stored in the App Service file system, logs are subject to the available storage for your pricing tier (see [App Service limits](../azure-resource-manager/management/azure-subscription-service-limits.md#app-service-limits)).
4040

4141
> [!NOTE]
4242
> App Service provides a dedicated, interactive diagnostics tool to help you troubleshoot your application. For more information, see [Azure App Service diagnostics overview](overview-diagnostics.md).
4343
>
44-
> In addition, you can use other Azure services to improve the logging and monitoring capabilities of your app, such as [Azure Monitor](../azure-monitor/app/azure-web-apps.md).
44+
> In addition, you can use other Azure services, such as [Azure Monitor](../azure-monitor/app/azure-web-apps.md), to improve the logging and monitoring capabilities of your app.
4545
>
4646
4747
## Enable application logging (Windows)
@@ -53,7 +53,7 @@ Select **On** for either **Application Logging (Filesystem)** or **Application L
5353
The **Filesystem** option is for temporary debugging purposes, and turns itself off in 12 hours. The **Blob** option is for long-term logging, and needs a blob storage container to write logs to. The **Blob** option also includes additional information in the log messages, such as the ID of the origin VM instance of the log message (`InstanceId`), thread ID (`Tid`), and a more granular timestamp ([`EventTickCount`](/dotnet/api/system.datetime.ticks)).
5454

5555
> [!NOTE]
56-
> Currently only .NET application logs can be written to the blob storage. Java, PHP, Node.js, Python application logs can only be stored on the App Service file system (without code modifications to write logs to external storage).
56+
> Currently only .NET application logs can be written to the blob storage. Java, PHP, Node.js, and Python application logs can only be stored on the App Service file system (without code modifications to write logs to external storage).
5757
>
5858
> Also, if you [regenerate your storage account's access keys](../storage/common/storage-account-create.md), you must reset the respective logging configuration to use the updated access keys. To do this:
5959
>
@@ -100,7 +100,7 @@ In **Retention Period (Days)**, set the number of days the logs should be retain
100100
> If you [regenerate your storage account's access keys](../storage/common/storage-account-create.md), you must reset the respective logging configuration to use the updated keys. To do this:
101101
>
102102
> 1. In the **Configure** tab, set the respective logging feature to **Off**. Save your setting.
103-
> 2. Enable logging to the storage account blob again. Save your setting.
103+
> 1. Enable logging to the storage account blob again. Save your setting.
104104
>
105105
>
106106
@@ -114,9 +114,9 @@ When finished, select **Save**.
114114

115115
To save the error page or failed request tracing for Windows apps in the [Azure portal](https://portal.azure.com), navigate to your app and select **App Service logs**.
116116

117-
Under **Detailed Error Logging** or **Failed Request Tracing**, select **On**, then select **Save**.
117+
Under **Detailed Error Logging** or **Failed Request Tracing**, select **On**, and then select **Save**.
118118

119-
Both types of logs are stored in the App Service file system. Up to 50 errors (files/folders) are retained. When the number of HTML files exceeds 50, the oldest error files are automatically deleted.
119+
Both types of logs are stored in the App Service file system. Up to 50 errors (files or folders) are retained. When the number of HTML files exceeds 50, the oldest error files are automatically deleted.
120120

121121
The Failed Request Tracing feature by default captures a log of requests that failed with HTTP status codes between 400 and 600. To specify custom rules, you can override the `<traceFailedRequests>` section in the *web.config* file.
122122

@@ -130,7 +130,7 @@ In your application code, you use the usual logging facilities to send log messa
130130
System.Diagnostics.Trace.TraceError("If you're seeing this, something bad happened");
131131
```
132132

133-
By default, ASP.NET Core uses the [Microsoft.Extensions.Logging.AzureAppServices](https://www.nuget.org/packages/Microsoft.Extensions.Logging.AzureAppServices) logging provider. For more information, see [ASP.NET Core logging in Azure](/aspnet/core/fundamentals/logging/). For information about WebJobs SDK logging, see [Get started with the Azure WebJobs SDK](./webjobs-sdk-get-started.md#enable-console-logging)
133+
By default, ASP.NET Core uses the [Microsoft.Extensions.Logging.AzureAppServices](https://www.nuget.org/packages/Microsoft.Extensions.Logging.AzureAppServices) logging provider. For more information, see [ASP.NET Core logging in Azure](/aspnet/core/fundamentals/logging/). For information about WebJobs SDK logging, see [Get started with the Azure WebJobs SDK](./webjobs-sdk-get-started.md#enable-console-logging).
134134
- Python applications can use the [OpenCensus package](/previous-versions/azure/azure-monitor/app/opencensus-python) to send logs to the application diagnostics log.
135135

136136

@@ -139,7 +139,7 @@ In your application code, you use the usual logging facilities to send log messa
139139
Before you stream logs in real time, enable the log type that you want. Any information written to the console output or files ending in .txt, .log, or .htm that are stored in the */home/LogFiles* directory (D:\home\LogFiles) is streamed by App Service.
140140

141141
> [!NOTE]
142-
> Some types of logging buffer write to the log file, which can result in out of order events in the stream. For example, an application log entry that occurs when a user visits a page may be displayed in the stream before the corresponding HTTP log entry for the page request.
142+
> Some types of logging buffer write to the log file, which can result in events appearing in the incorrect order in the stream. For example, an application log entry that occurs when a user visits a page may be displayed in the stream before the corresponding HTTP log entry for the page request.
143143
>
144144

145145
### In Azure portal
@@ -157,40 +157,40 @@ To stream logs live in [Cloud Shell](../cloud-shell/overview.md), use the follow
157157
az webapp log tail --name appname --resource-group myResourceGroup
158158
```
159159

160-
To filter specific log types, such as HTTP, use the **--Provider** parameter. For example:
160+
To filter specific log types, such as HTTP, use the **--provider** parameter. For example:
161161

162162
```azurecli-interactive
163163
az webapp log tail --name appname --resource-group myResourceGroup --provider http
164164
```
165165

166-
### In local terminal
166+
### In the local terminal
167167

168-
To stream logs in the local console, [install Azure CLI](/cli/azure/install-azure-cli) and [sign in to your account](/cli/azure/authenticate-azure-cli). Once signed in, followed the [instructions for Cloud Shell](#in-cloud-shell)
168+
To stream logs in the local console, [install Azure CLI](/cli/azure/install-azure-cli) and [sign in to your account](/cli/azure/authenticate-azure-cli). After you're signed in, follow the [instructions for Cloud Shell](#in-cloud-shell).
169169

170170
## Access log files
171171

172172
If you configure the Azure Storage blobs option for a log type, you need a client tool that works with Azure Storage. For more information, see [Azure Storage Client Tools](../storage/common/storage-explorers.md).
173173

174-
For logs stored in the App Service file system, the easiest way is to download the ZIP file in the browser at:
174+
For logs stored in the App Service file system, the easiest way to access the files is to download the ZIP file in the browser at:
175175

176176
- Linux/custom containers: `https://<app-name>.scm.azurewebsites.net/api/logs/docker/zip`
177177
- Windows apps: `https://<app-name>.scm.azurewebsites.net/api/dump`
178178
179-
For Linux/custom containers, the ZIP file contains console output logs for both the docker host and the docker container. For a scaled-out app, the ZIP file contains one set of logs for each instance. In the App Service file system, these log files are the contents of the */home/LogFiles* directory. Deployment logs are stored in */site/deployments/*.
179+
For Linux/custom containers, the ZIP file contains console output logs for both the Docker host and the Docker container. For a scaled-out app, the ZIP file contains one set of logs for each instance. In the App Service file system, these log files are the contents of the */home/LogFiles* directory. Deployment logs are stored in */site/deployments/*.
180180
181181
For Windows apps, the ZIP file contains the contents of the *D:\Home\LogFiles* directory in the App Service file system. It has the following structure:
182182
183183
| Log type | Directory | Description |
184184
|-|-|-|
185185
| **Application logs** |*/LogFiles/Application/* | Contains one or more text files. The format of the log messages depends on the logging provider you use. |
186-
| **Failed Request Traces** | */LogFiles/W3SVC#########/* | Contains XML files, and an XSL file. You can view the formatted XML files in the browser. |
187-
| **Detailed Error Logs** | */LogFiles/DetailedErrors/* | Contains HTM error files. You can view the HTM files in the browser.<br/>Another way to view the failed request traces is to navigate to your app page in the portal. From the left menu, select **Diagnose and solve problems**, then search for **Failed Request Tracing Logs**, then click the icon to browse and view the trace you want. |
188-
| **Web Server Logs** | */LogFiles/http/RawLogs/* | Contains text files formatted using the [W3C extended log file format](/windows/desktop/Http/w3c-logging). This information can be read using a text editor or a utility like [Log Parser](https://www.iis.net/downloads/community/2010/04/log-parser-22).<br/>App Service doesn't support the `s-computername`, `s-ip`, or `cs-version` fields. |
189-
| **Deployment logs** | */LogFiles/Git/* and */deployments/* | Contain logs generated by the internal deployment processes, as well as logs for Git deployments. |
186+
| **Failed Request Traces** | */LogFiles/W3SVC#########/* | Contains XML files and an XSL file. You can view the formatted XML files in the browser. |
187+
| **Detailed Error Logs** | */LogFiles/DetailedErrors/* | Contains HTM error files. You can view the HTM files in the browser.<br/>Another way to view the failed request traces is to navigate to your app page in the portal. From the left menu, select **Diagnose and solve problems**, search for **Failed Request Tracing Logs**, and then click the icon to browse and view the trace you want. |
188+
| **Web Server Logs** | */LogFiles/http/RawLogs/* | Contains text files formatted using the [W3C extended log file format](/windows/desktop/Http/w3c-logging). You can read these files by using a text editor or a utility like [Log Parser](https://www.iis.net/downloads/community/2010/04/log-parser-22).<br/>App Service doesn't support the `s-computername`, `s-ip`, or `cs-version` fields. |
189+
| **Deployment logs** | */LogFiles/Git/* and */deployments/* | Contains logs generated by the internal deployment processes, as well as logs for Git deployments. |
190190
191191
## Send logs to Azure Monitor
192192
193-
With the new [Azure Monitor integration](https://aka.ms/appsvcblog-azmon), you can [create Diagnostic Settings](https://azure.github.io/AppService/2019/11/01/App-Service-Integration-with-Azure-Monitor.html#create-a-diagnostic-setting) to send logs to Storage Accounts, Event Hubs and Log Analytics. When you add a diagnostic setting, App Service adds app settings to your app, which triggers an app restart.
193+
With [Azure Monitor integration](https://aka.ms/appsvcblog-azmon), you can [create Diagnostic Settings](https://azure.github.io/AppService/2019/11/01/App-Service-Integration-with-Azure-Monitor.html#create-a-diagnostic-setting) to send logs to storage accounts, event hubs and Log Analytics. When you add a diagnostic setting, App Service adds app settings to your app, which triggers an app restart.
194194
195195
> [!div class="mx-imgBorder"]
196196
> ![Diagnostic Settings](media/troubleshoot-diagnostic-logs/diagnostic-settings-page.png)
@@ -205,6 +205,6 @@ For Diagnostic Settings restrictions, refer to the [official Diagnostic Settings
205205
206206
## <a name="nextsteps"></a> Next steps
207207
* [Query logs with Azure Monitor](../azure-monitor/logs/log-query-overview.md)
208-
* [How to Monitor Azure App Service](web-sites-monitor.md)
208+
* [How to Monitor Azure App Service](monitor-app-service.md)
209209
* [Troubleshooting Azure App Service in Visual Studio](troubleshoot-dotnet-visual-studio.md)
210210
* [Tutorial: Run a load test to identify performance bottlenecks in a web app](../load-testing/tutorial-identify-bottlenecks-azure-portal.md)

0 commit comments

Comments
 (0)