question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Steeltoe.Extensions.Logging.SerilogDynamicLogger not working as expected

See original GitHub issue

Describe the bug

I have a .net core 2.2 application which is deployed in PCF 2.4.12. Configured Serilog and enabled dynamic console to adjust the log levels without restarting the application. But unfortunately the number of loggers appearing PCF Apps Manager is just 1. Upon adjusting the levels, there is no effect.

Steps to reproduce

Steps to reproduce the behavior:

  1. Deploy https://github.com/SteeltoeOSS/Samples/tree/master/Management/src/AspDotNetCore/CloudFoundry after integrating Serilog.
  2. Configure Serilog dynamic console like below
public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseCloudFoundryHosting()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()
                .UseStartup<Startup>()
                .ConfigureAppConfiguration((builderContext, config) =>
                {
                    config.SetBasePath(builderContext.HostingEnvironment.ContentRootPath)
                        .AddCommandLine(args)
                        .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
                        .AddJsonFile($"appsettings.{builderContext.HostingEnvironment.EnvironmentName}.json", optional: true)
                        .AddCloudFoundry()
                        .AddEnvironmentVariables();
                })
                .UseSerilog((hostingContext, loggerConfiguration) => loggerConfiguration
                     .ReadFrom.Configuration(hostingContext.Configuration)
                     .WriteTo.Trace())
                .ConfigureLogging((builderContext, loggingBuilder) =>
                {
                    loggingBuilder.AddConfiguration(builderContext.Configuration.GetSection("Logging"));
                    loggingBuilder.AddDebug();
                    // Add Serilog Dynamic Logger 
                    loggingBuilder.AddSerilogDynamicConsole();
                })
                .Build();

            host.RunWithTasks();

Expected behavior

Number of loggers appearing in PCF Apps Manager should be matching the typed ILogger<T> used in the application and upon the adjusting the log levels, log statements should appear accordingly.

Environment (please complete the following information):

  • Platform: PCF 2.4.12
  • OS: Linux
  • .NET Version : .net core 2.2
  • Steeltoe Version: 2.3.0
  • Any other library versions to note

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
hananielcommented, Sep 9, 2020

@hananiel the debug and trace level works if we add Logging section, I was just going to tell you this - glad you figured out. I am going close this issue. Feel free to open a new issue if you have more issues to resolve.

1reaction
hananielcommented, Sep 9, 2020

@ani00763 yes, I can confirm this sample is having that issue both locally and on cf. let me investigate and get back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Steeltoe.Extensions.Logging.SerilogDynamicLogger not ...
Describe the bug I have a .net core 2.2 application which is deployed in PCF 2.4.12. Configured Serilog and enabled dynamic console to ......
Read more >
Steeltoe dynamic logging configuration with Serilog(or any ...
1 Answer 1 ... Steeltoe now has preliminary support for Serilog via the Steeltoe.Extensions.Logging.SerilogDynamicLogger , available in the dev ...
Read more >
Steeltoe.Extensions.Logging.DynamicLogger 3.2.3
Steeltoe Dynamic Console Logger.
Read more >
Serilog Dynamic Logger
Serilog Dynamic Logger. This logging provider extends the dynamic logging provider with Serilog. This allows logger levels configured via Serilog to be ...
Read more >
Steeltoe.Extensions.Logging.DynamicLogger 3.0.2
Steeltoe Dynamic Console Logger.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found