4

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 :)

Evan Park
  • 528
  • 1
  • 6
  • 20

2 Answers2

2

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.

Katy Shimizu
  • 1,051
  • 5
  • 9
1

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.

Ivan Glasenberg
  • 29,865
  • 2
  • 44
  • 60