Evan Park
Evan Park

Reputation: 538

Azure Application Insights with Azure Function. Log Debug not showing up

My Azure function is currently logging to Application Insights.

While Logs generated by logger.logInformation line is showing up on Application Insights, logs generated by logger.logDebug line is not showing up.

I heard there is a way to temporarily enable logging through this line by enabling certain logging levels for application insights.

Can someone help me achieve this or direct me towards some documentation?

Thanks :)

Upvotes: 4

Views: 3419

Answers (2)

Ivan Glasenberg
Ivan Glasenberg

Reputation: 29940

A detailed steps as below:

1.Nav to your function app kudu console: https://your_function_name.scm.azurewebsites.net/DebugConsole

2.In kudu console, nav to the host.json(D:\home\site\wwwroot), then click edit button for host.json: enter image description here

3.Modify the host.json like below, then save it: enter image description here

4.After run your function app, go to application insights search, you will find the debug message:

Use LogDebug in code: enter image description here

In application insights, check the debug message: enter image description here

5.For v1 function, you should use the link as per @Kath metioned, to modify the host.json.

Upvotes: 1

Katy Shimizu
Katy Shimizu

Reputation: 1111

You're looking for the logLevel setting in host.json (Assumes Functions V2. For Functions V1, look at the logger setting.) Documentation for both here.

Upvotes: 2

Related Questions