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.

Broken app startup when Overriding Microsoft logs

See original GitHub issue

I have a strange behaviour when I start a new Asp .Net Core project in VS2019, with Docker support on Linux. I add the support of docker-compose, and update the default program.cs with the one in the EarlyInitializationSample. (With Serilog.AspNetCore 3.0 nuget package) I start the app, everything works fine, it launches my browser on the WeatherForecastController (the demo controller from the Visual Studio template).

If I add a filter in the logger configuration (.MinimumLevel.Override("System", LogEventLevel.Warning)), it still works as expected.

BUT ! If I replace System by Microsoft (.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)), the application start, but seems to stop loading stuff in the middle of the startup process, and it doesn’t launch my browser.

My app seems to respond normally, but I fear it could hide something wierd…

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
tbrazcommented, Nov 30, 2019

Thanks for the follow-up 👍

Just to clarify, the problem is just that VS does not launch the browser? If so, it might be that VS is waiting to see some specific (Microsoft.*) log output as an indication that the process is ready.

I’ve encountered the same issue, and after reading this thread and your comment in particular I made some testing with the logging output.

It seems indeed that VS is waiting on a specific output from Microsoft.Hosting.Lifetime to launch the browser.

[INF][Microsoft.Hosting.Lifetime] Now listening on: https://[::]:443
[INF][Microsoft.Hosting.Lifetime] Now listening on: http://[::]:80
[INF][Microsoft.Hosting.Lifetime] Application started. Press Ctrl+C to shut down.

Those are the first log outputs from that Namespace that appear in the logs and if I silence them (change the log level to something higher than Information) the browser won’t launch.

There is no issue what so ever with Serilog.

1reaction
4wakened5leepercommented, Oct 10, 2019

Indeed, it could just be a VS issue as it’s the only visible problem… But it works with .Net Core 2.2, so I’ll try with the next release of .Net Core 3 !

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot ASP.NET Core on Azure App Service and IIS
This article provides information on common app startup errors and instructions on how to diagnose errors when an app is deployed to Azure ......
Read more >
Is .NET Core 2.0 logging broken?
The LogLevel section configures logging level for all namespaces ( Default key) or for a specific namespace ( System overrides the default ...
Read more >
serilog minimumlevel override not working for console but ...
1 Answer 1 ... It looks like you're missing UseSerilog() in your program start-up code: the console output you've show is from the...
Read more >
Configure your app to start at log-in - Windows Developer Blog
If your app is enabled for startup activation, you should handle this case in your App class by overriding the OnActivated method. Check...
Read more >
Serilog 2.1 MinimumLevel.Override()
The Serilog MinimumLevel setting determines at which level log events are generated:
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