You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/app-service/troubleshoot-diagnostic-logs.md
+23-23Lines changed: 23 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Enable diagnostics logging
3
3
description: Learn how to enable diagnostic logging and add instrumentation to your application, as well as how to access the information logged by Azure.
@@ -25,23 +25,23 @@ Azure provides built-in diagnostics to assist with debugging an [App Service app
25
25
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).
26
26
27
27
> [!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.
29
29
>
30
30
31
-
|Type|Platform|Location|Description|
31
+
|Type|Platform|Log storage location|Description|
32
32
|-|-|-|-|
33
33
| 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.|
34
34
| 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. |
37
37
| 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. |
38
38
39
39
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)).
40
40
41
41
> [!NOTE]
42
42
> 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).
43
43
>
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.
45
45
>
46
46
47
47
## Enable application logging (Windows)
@@ -53,7 +53,7 @@ Select **On** for either **Application Logging (Filesystem)** or **Application L
53
53
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)).
54
54
55
55
> [!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).
57
57
>
58
58
> 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:
59
59
>
@@ -100,7 +100,7 @@ In **Retention Period (Days)**, set the number of days the logs should be retain
100
100
> 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:
101
101
>
102
102
> 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.
104
104
>
105
105
>
106
106
@@ -114,9 +114,9 @@ When finished, select **Save**.
114
114
115
115
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**.
116
116
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**.
118
118
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.
120
120
121
121
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.
122
122
@@ -130,7 +130,7 @@ In your application code, you use the usual logging facilities to send log messa
130
130
System.Diagnostics.Trace.TraceError("If you're seeing this, something bad happened");
131
131
```
132
132
133
-
Bydefault, ASP.NETCoreusesthe [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
+
Bydefault, ASP.NETCoreusesthe [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).
Tostreamlogsinthelocalconsole, [installAzureCLI](/cli/azure/install-azure-cli) and [signintoyouraccount](/cli/azure/authenticate-azure-cli). Oncesignedin, followedthe [instructionsforCloudShell](#in-cloud-shell)
168
+
Tostreamlogsinthelocalconsole, [installAzureCLI](/cli/azure/install-azure-cli) and [signintoyouraccount](/cli/azure/authenticate-azure-cli). Afteryou're signed in, follow the [instructions for Cloud Shell](#in-cloud-shell).
169
169
170
170
## Access log files
171
171
172
172
IfyouconfiguretheAzureStorageblobsoptionforalogtype, youneedaclienttoolthatworkswithAzureStorage. Formoreinformation, see [AzureStorageClientTools](../storage/common/storage-explorers.md).
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:
182
182
183
183
| Log type | Directory | Description |
184
184
|-|-|-|
185
185
| **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. |
190
190
191
191
## Send logs to Azure Monitor
192
192
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.
0 commit comments