Microsoft Azure: Configure Azure App Service Logging
Azure App service logging are the output of runtime trace statement in the different app code. logging feature will help you might only want to see a logged message when a particular level of error has occurred, While developing a Web App or an API, this can be very useful in order to debug it.
Azure provides built-in diagnostics to assist with debugging an App service App. In this article, you will learn what are the different types of diagnostics logging and steps to enable in Azure Portal. I have shared in my previous article details information to create a web app using the Azure portal and use the same application for demo.
Types of Azure App service Logging
Azure provides the below-logging feature in the new Azure portal and all the logging features will support the Windows platform and some of the logging will support Linux as well. Logs can be stored and located for accessing information in the portal.- Application Logging (Filesystem and Blob)
- Web Server logging (Filesystem and Storage)
- Detailed Error Message
- Failed request tracing
Step to Enable Application logging
Application logs message generated by the application. There are two options available in application logging as Filesystem and Blob. Contains one or more text files. The format of the log messages depends on the logging provider and access logging in the following directory - /Logfile/Application/Filesystem
The Filesystem option is for temporary debugging purposes and turns itself off in 12 hours.Blob
The Blob option is for long-term logging and needs a blob storage container to write logs to.Error Level
Application error detail fall into the following error level- Error – Included category by Error and Critical
- Warning - Included category by Warning, Error, and Critical
- Information - Included category by Info, Warning, Error, and Critical
- Verbose - Trace, Debug, Info, Warning, Error, Critical (all categories)
Step 1: Navigate to the Azure portal and select your Web app and select App Service logs.
Step 2: Select on either Application logging Filesystem or Blob or both, in this demo I have enabled Application logging as a File system.
Step to Enable Web Server logging
Web Server Logging also having two different types of storage and File Systems, Raw HTTP request data in the W3C extended log file format. Each log message includes data such as the HTTP method, resource URI, client IP, client port, user agent, response code, and store log file in the /LogFiles/http/RawLogs/. You can follow the below steps to enable webserver loggingStep 1: Navigate to the Azure portal and select your Web app and select App Service logs.
Step 2: Select on either Web server logging Filesystem or Blob, in this demo I have enabled server logging as a File system.
Step 3: Provide Quota and Retention Period (Days), set the number of days the logs should be retained.
Step 4: Once all the details filled and click on save options
Detailed Error Message
Detail Error Message selects as ON, they will generate an error message as a File system and 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 and file will store in the directory is http://logfiles/DetailedErrors/Failed request tracing
The Failed request tracing 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. The file format is XML files and an XSL file. You can view the formatted XML files in the browser and a file store directory is /LogFiles/W3SVC#########/Download Log File
All the different logging has Specify logs stored in the App Service file system, the easiest way is to download the ZIP file in the browser atWindows apps: https://<app-name>.scm.azurewebsites.net/api/dump
Linux/container apps: https://<app-name>.scm.azurewebsites.net/api/logs/docker/zip
0 Comments