Azure / Azure/azure-functions-host

Host.json- Loglevel not working with appinsight in Node js Function

Open
#6,965 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

#### Is your question related to a specific version? If so, please specify: **2.0**

#### What language does your question apply to? (e.g. C#, JavaScript, Java, All) - **Node.JS**

#### Question

We are using applicationinsight defaultclient to log all the messages through trackTrace method . In host.Json file we mentioned the Function logging level as "Information" but in Azure app insight dashboard logs we able to see logs from starting from severityLevel as 0 till 3. How can we make appinsight show logs set at severityLevel as Information and above ? We don't want logs mentioned as Severitylevel as Verbose in our production Environment.

Ex- in node function class
//Below message should not be displayed in appinsight logs dashboard as Severitylevel is set as Verbose
appInsightClient.trackTrace({ message:` ${requestId} --Function started `
, SeverityLevel.Verbose
});
//Below message should be displayed in appinsight logs dashboard.
appInsightClient.trackTrace({ message:` ${requestId} --Function started `
, SeverityLevel.Information
});

**Host.json details
![log-severityLevel](https://user-images.githubusercontent.com/22384700/101060880-7ec0f800-3555-11eb-9752-b9abe86e27a5.png)
**

{
"version": "2.0",
"extensionBundle": {
"id": "Microsoft.Azure.Functions.ExtensionBundle",
"version": "[1.*, 2.0.0)"
},
"logging": {
"fileLoggingMode": "always",
"logLevel": {
"default": "Information",
"Host.Results": "Error",
"Function": "Information",
"Host.Aggregator": "Error"
}
}

}

Contributor guide

Open the contributing guide

Research direction

Start with host.json and the Node.js function code that calls Application Insights defaultClient.trackTrace with SeverityLevel.Verbose and SeverityLevel.Information. Compare the host.json logging configuration with the severity levels shown in the Application Insights dashboard, and check any relevant host logging or telemetry tests. Done means the issue explains whether host.json controls these traces and identifies the configuration or limitation affecting the displayed levels.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, node.js
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.