How to view stdout/stderr when running Node JS on App Service?

Tommy Paulsen 0 Reputation points
2023-12-12T20:28:14.2833333+00:00

I'm running a Node JS app inn App Service on Linux. The console log you can access in portal.azure.com or from az webapp log tail only show the server output and not stdout from inside the docker container. Any way to get stdout from Node without instrumenting your app to work with Application Insights?

I'm running a java application inn Azure Spring Apps and that logs everything to the log

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,216 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. brtrach-MSFT 17,166 Reputation points Microsoft Employee
    2023-12-15T03:21:29.6+00:00

    @Tommy Paulsen To view the stdout/stderr logs generated from inside the container in which your Node.js app runs, you can use the Log stream feature in the Azure portal. Here are the steps to follow:

    1. In the Azure portal, navigate to your App Service.
    2. In the left menu, scroll down to the Monitoring section and select Log stream.
    3. After a few seconds, the output window shows a message indicating that you're connected to the log-streaming service. You can generate more output activity by refreshing the page in the browser.

    If you prefer to use the Azure CLI, you can use the az webapp log tail command to stream logs. Here's an example:

    az webapp log tail --name  --resource-group 
    
    
    
    

    This command streams the logs for the specified App Service app.

    However, if you want to get stdout from Node without instrumenting your app to work with Application Insights, you can use console.log() statements in your code to write to stdout. These statements will be captured in the logs generated by the Log stream feature or the az webapp log tail command.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.