'Azure Functions: How to programmatically read log levels?

For Azure Functions, log levels are configured in the host.json. How to read its values programmatically for logging nodes?

  1. We tried to read it from the environment variables as described here, but logging/ log level entries do not appear (but others do)...
System.Environment.GetEnvironmentVariable(); 
// This lists a lot of environment variables, but none related to logging.
  1. We tried to implement an override of host json, but in contrast to the documentation, the configuration object always remains null:
        public class AzureFunctionsJobHostSection
        {
            public LoggingSection Logging { get; set; }

            public class LoggingSection
            {
                public LogLevelSection LogLevel { get; set; }

                public class LogLevelSection
                {
                    public string EntityFrameworkCore { get; set; }
                }
            }
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source