Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
Enable streaming execution logs in Azure Functions
While developing an application, you often want to see what's being written to the logs in near real time when running in Azure.
There are two ways to view the stream of log files that your function executions generate.
When your function app is connected to Application Insights, you can use Live Metrics Stream to view log data and other metrics in near real-time in the Azure portal. Live Metrics stream is the recommended way to view streaming logs it supports all plan types and is the method to use when monitoring functions running on multiple-instances. It also uses sampled data, so it can protect you from producing too much data during times of peak loads.
Important
By default, the Live Metrics stream includes logs from all apps connected to a given Application Insights instance. When you have more than one app sending log data, you should filter your log stream data.
Log streams can be viewed both in the portal and in most local development environments. The way that you enable and view streaming logs depends on your log streaming method, either Live Metrics or built-in.
To view the Live Metrics Stream for your app, select the Overview tab of your function app.
When you have Application Insights enabled, you see an Application Insights link under Configured features. This link takes you to the Application Insights page for your app.
In Application Insights, select Live Metrics Stream. Sampled log entries are displayed under Sample Telemetry.
👁 Screenshot showing how to view Live Metrics Stream in the portal.
Run this command in the Terminal to display the Live Metrics Stream in a new browser window:
func azure functionapp logstream <FunctionAppName> --browser
Use this command to display the Live Metrics Stream in a new browser window:
func azure functionapp logstream <FunctionAppName> --browser
To view streaming logs in the portal, select the Platform features tab in your function app. Then, under Monitoring, choose Log streaming.
👁 Screenshot showing how to enable streaming logs in the portal.
This setting connects your app to the log streaming service and application logs are displayed in the window. You can toggle between Application logs and Web server logs.
👁 Screenshot showing how to view streaming logs in the portal.
To turn on the streaming logs for your function app in Azure:
Select F1 to open the command palette, and then search for and run the command Azure Functions: Start Streaming Logs.
Select your function app in Azure, and then select Yes to enable application logging for the function app.
Trigger your functions in Azure. Notice that log data is displayed in the Output window in Visual Studio Code.
When you're done, remember to run the command Azure Functions: Stop Streaming Logs to disable logging for the function app.
Use the func azure functionapp logstream command to start receiving streaming logs of a specific function app running in Azure, as in this example:
func azure functionapp logstream <FunctionAppName>
Next steps
Feedback
Was this page helpful?
