Tuesday, October 4, 2016

Retrieving diagnostic logs

You have many choices when it comes to retrieving diagnostic logs or just viewing the contents of the logs. Regardless of how you choose to retrieve diagnostic logs, it's helpful to understand where the logs are stored on the website's file system. Below Table lists the different logs and their location in the file system.












FAILED REQUEST LOGS STYLE SHEET FILE :
 
When failed request logging is enabled, the folder where the logs are stored contains an .xml file and a file named Freb.xsl file. The .xml file contains the log data generated by the server. The Freb.xsl file is a style sheet document that enhances viewing the .xml file in your browser. When downloading failed request logs to your local computer, save the Freb.xsl in the same folder with .xml file. Then, open the .xml file using your browser for an enhanced viewing experience. This makes identifying errors and warnings in the log much easier.

Enabling diagnostics logs using the management portal

In the management portal, you can enable application and site diagnostic logs by opening the Website blade for your website and clicking the Diagnostics Logs part under the Operations section. This will open the Logs blade, where you can enable the logs and configure the logging level, as shown in Figure



Enabling diagnostics logs using Azure PowerShell cmdlets You can enable and disable diagnostic logs using the Set-AzureWebsite cmdlet. As an example, the code shown here enables the web server logging and the failed request tracing.

$wsName = "contoso-web"
Set-AzureWebsite -Name $wsName -RequestTracingEnabled $true -HttpLoggingEnabled $true










Enabling application and site diagnostics Logs

Diagnostic logging is not enabled by default. It is up to you to enable and conigure logging in a way that provides the information you need to troubleshoot issues. There are two categories of Azure Website log files:

  •  Application diagnostic logs
  •  Site diagnostic logs
Application diagnostic logs contain information produced by the application code. This can be tracing that the developers instrumented when writing the code, or exceptions that were raised by the application. When you enable application logs, you must specify the logging level, which can be one of the following:

  •  Error
  •  Warning
  •  Information
  •  Verbose

Site diagnostic logs contain information produced by the web server that the web application is running on. Three types of site diagnostic logs can be enabled:

 Web Server Logging Contains all HTTP events on a website and is formatted using the W3C extended log file format
 Detailed Error Messages Contains information on requests that resulted in a HTTP status code of 400 or higher.
 Failed Request Tracing Contains detailed traces for any failed requests. This log also contains traces for all of the IIS components that were involved in processing the request. This can be useful when trying to isolate where in the system a failure is occurring.

Note :: Application diagnostic logs can be saved to the website's file system, Azure Table Storage,or Azure Blob Storage. The web server logging in site diagnostics can be saved to the website's file system or Azure Blob Storage.



Featured Posts

Adding Accesspolicy to KeyVault for Service Principal Using Portal and Powershell

  Scripts path : https://drive.google.com/drive/folders/1sbBpnVFgXhUIXLdf2E9heyWDeU2f9427?usp=sharing  Adding Accesspolicy to KeyVault for S...