As per the Azure documentation, Functions V2 uses the .NET Core logging filter hierarchy for configuration.
In the following example, an instance of ILogger is injected into the Run method of the function.
[FunctionName("MyFunction")]
public static void Run([TimerTrigger("0 */1 * * * *")]TimerInfo myTimer, ILogger logger, ExecutionContext executionContext)
{
logger.LogInformation("I don't want to see this in production!"));
}
When inspecting the ILogger object, each LoggerInformation element has MinLevel of null which seems to log all levels.
In production, I only want to log at the Error level. I would like to be able to configure this using an environment variable but I cannot find any documentation which explains how to achieve this. I have tried adding the following environment variable to no effect:
"logging__logLevel__Default: "Error"