Generating log files on Azure Application Services


Userlevel 2
Badge

In this knowledge-base article, we will delve into the process of generating logs for an application that utilizes the CData ADO.NET connector and is hosted on Azure App Services.  

 

After developing our ASP.NET Core application, we build the project and publish it to Azure. To access the driver’s logs, we must use the path D:/home/LogFiles/file.txt. This method of generating Stream diagnostic logs has been documented by Microsoft, and the steps to accomplish this are outlined below: 

 

For this article, I am using the CData ADO.NET Provider for Databricks. 

  

  • Initially, navigate to the Startup.cs class where the connection string is stored. In the Logfile property append the path D:/home/LogFiles/<file_name>.txt and set the preferred verbosity level. 

 

 

After these modifications, we need to build our project again and republish it on Azure Application Services to reflect the changes we just made. 

 

The subsequent step involves accessing the Azure Portal and navigating to the Web App that was previously deployed. We proceed to the Logs section and then click on the ‘Configure Logs’ button in the ‘App Service Logs’ section. 

 

Upon accessing the App Service Logs, you will encounter various methods of managing logs from Azure. We need to toggle ‘Application logging (Filesystem)’ to ON and select the preferred level for the details to be included in the log. After making the necessary adjustments, click the ‘Save’ button, and you’re all set. Please refer to the screenshot below: 

 

 

Please note that this Application Logging feature automatically turns off after 12 hours. It requires activating this feature to enable the streaming of log data. 

 

We can now return to our Web App and select the ‘Log Stream’ section. A console will appear, which may take a few seconds to establish connections. Once it indicates that we are connected, we can continue to execute our processes in the cloud (in my case, I simply refreshed the page), and the changes were captured in the log. Please refer to the screenshot below for reference: 

 

 

To retrieve these logs, you can click the ‘Copy’ button and paste them into a Notepad. In this way, we successfully obtained the log from the driver in the Azure Application Services. 


This topic has been closed for comments