Steeltoe icon indicating copy to clipboard operation
Steeltoe copied to clipboard

Loggers actuator: incorrect log level reported

Open davgia opened this issue 3 years ago • 0 comments

Describe the bug

It appears that the logger actuator /actuator/loggers reports incorrect log levels. Even if the actuator report all logger sources to be off (while the default one is always trace) I see from debug console log messages. If I call the /actuator/loggers/<name> to change the log level the next GET request to loggers shows that the modification has been done successfully.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a simple application
  2. Configure logging from IHostBuilder using .ConfigureLogging and AddDynamicSerilog
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            var builder = Host.CreateDefaultBuilder(args);

            return builder
                .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>())
                .ConfigureLogging((builderContext, loggerBuilder) =>
                {
                    var logConfig = new LoggerConfiguration().ReadFrom.Configuration(builderContext.Configuration);
                    loggerBuilder.AddDynamicSerilog(logConfig);
                })
                .AddSteeltoe();
        }

Expected behavior

I don't know only the initial log level is incorrect, in any case the actuator should always the report the correct log level.

Environment (please complete the following information):

  • Steeltoe Version: 3.2.1
  • Platform: Local / Kubernetes
  • OS: Windows / Linux
  • .NET Version: .NET Core 3.1
  • Any other library versions to note:
  <PackageReference Include="Serilog.AspNetCore" Version="6.0.1" />
  <PackageReference Include="Serilog.Formatting.Elasticsearch" Version="8.4.1" />
  <PackageReference Include="Serilog.Settings.Configuration" Version="3.3.0" />
  <PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" />

davgia avatar Sep 29 '22 20:09 davgia