I am using application insights to create custom logs for my Azure function using trackTrace. How can I view the logs from Visual Studio Code in local?

Vaidehi Mani 6 Reputation points
2020-07-02T04:58:47.907+00:00

I am coding in Nodejs, in Visual Studio Code, using Azure functions.
I am able to stream logs in local, but i am only able to view logs to console(console.log) and context.log.
Not able to view custom logs using application insights in local.
I am able to view the trace logs in Azure portal. But I want to know how to view it in local, in VS Code.

My code
let appInsights = require('applicationinsights');
appInsights.setup(<instrumentationKey>).start();
let client = appInsights.defaultClient;

client.trackTrace({
message: "message",
severity: appInsights.Contracts.SeverityLevel.Information
});

Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,309 questions
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,073 questions
0 comments No comments
{count} vote

1 answer

Sort by: Most helpful
  1. olufemia-MSFT 2,861 Reputation points
    2020-07-07T23:47:29.08+00:00

    Hi VaidehiMani-4888, sorry for the delayed response. If you haven't already, check out the guidance on viewing in local

    Also wanted to highlight this contentt on how to view request and exception summaries in code.

    11517-appinsightsvscodenjs.png

    You may also find this content on basic usage useful to your scenario.

    Don't hesitate to let us know if you need further assistance and we will gladly assist you further or help redirect this issue to the technical support channel If needed, send mail to AzCommunity@microsoft.com, include your Subscription ID and a link to this thread (for context).

    Cheers.

    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.