Application of logging severity is inconsistent with documentation
@kamperiadis is already working on this.
Since Feb 22, 2023.
Assessment
This issue has not been assessed yet.
Description
We are using the App Settings dialog to manage log levels for Azure Functions. According to https://learn.microsoft.com/en-us/azure/azure-functions/configure-monitoring?tabs=v2#configure-categories, the Host.Results setting controls logging of entries to the requests table. However, with version 4.13 of the runtime, having
AzureFunctionsJobHost__logging__logLevel__default = Warning
AzureFunctionsJobHost__logging__logLevel__Host__Results = Information
results in no request information being received by the requests table.
Investigative information
Please provide the following:
- Timestamp: 2022-11-01T00:16:54.2729718Z
- Function App name: com-foo-bar-20220830131408475
- Function name(s) (as appropriate): Functions.HttpExample
- Invocation ID: a8ac4748-f1c7-4a45-ac24-9b2fc92b7d9b
- Region: West US
Repro steps
Provide the steps required to reproduce the problem:
Configure the function with the following App Settings
{
"name": "AzureFunctionsJobHost__logging__logLevel__default",
"value": "Warning",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Function",
"value": "Information",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Function.HttpExample",
"value": "Information",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Function.HttpExample.User",
"value": "Warning",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Host__Aggregator",
"value": "Information",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Host__Results",
"value": "Information",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Microsoft",
"value": "Warning",
"slotSetting": false
},
{
"name": "AzureFunctionsJobHost__logging__logLevel__Worker",
"value": "Warning",
"slotSetting": false
},
Expected behavior
When the function is triggered, an entry should appear in the Application Insights requests table.
Actual behavior
No entry appears in the requests table.
Known workarounds
Changing this setting to Information will result in the entry appearing in the Request table
{
"name": "AzureFunctionsJobHost__logging__logLevel__default",
"value": "Information",
"slotSetting": false
},
Related information
Provide any related information
- Programming language: Java
Source
package org.example.functions;
import com.microsoft.azure.functions.ExecutionContext;
import com.microsoft.azure.functions.HttpMethod;
import com.microsoft.azure.functions.HttpRequestMessage;
import com.microsoft.azure.functions.HttpResponseMessage;
import com.microsoft.azure.functions.HttpStatus;
import com.microsoft.azure.functions.annotation.AuthorizationLevel;
import com.microsoft.azure.functions.annotation.FunctionName;
import com.microsoft.azure.functions.annotation.HttpTrigger;
import lombok.extern.slf4j.Slf4j;
import java.util.Optional;
/**
* Azure Functions with HTTP Trigger.
*/
@Slf4j
public class HttpTriggerFunction {
/**
* This function listens at endpoint "/api/HttpExample". Two ways to invoke it using "curl" command in bash:
* 1. curl -d "HTTP Body" {your host}/api/HttpExample
* 2. curl "{your host}/api/HttpExample?name=HTTP%20Query"
*/
@FunctionName("HttpExample")
public HttpResponseMessage run(
@HttpTrigger(
name = "req",
methods = {HttpMethod.GET, HttpMethod.POST},
authLevel = AuthorizationLevel.ANONYMOUS)
HttpRequestMessage<Optional<String>> request,
final ExecutionContext context) {
context.getLogger().info("2 Java HTTP trigger processed a request.");
// Parse query parameter
final String query = request.getQueryParameters().get("name");
final String name = request.getBody().orElse(query);
log.error("Error Log");
log.warn("Warning Log");
log.info("Info Log");
log.debug("Debug Log");
log.trace("Trace Log");
if (name == null) {
return request.createResponseBuilder(HttpStatus.BAD_REQUEST).body("Please pass a name on the query string or in the request body").build();
} else {
return request.createResponseBuilder(HttpStatus.OK).body("Hello, " + name).build();
}
}
}
- Dominant language
- Java
- Stars
- 103
- Forks
- 74
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure/azure-functions-java-worker
-
Difficulty 4/5 3-5 days Newbie friendliness 50/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
mcp-extension
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
mcp-extension
Azure/azure-functions-java-worker#863 · 1 assignee ·
All issues in Azure/azure-functions-java-worker
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100