Flush on shutdown
See original GitHub issueOther logging frameworks have different ways of telling the framework that the application is about to shut down. This is great for batching and/or async loggers since it will give them a chance to flush their buffered log message.
Example from Serilog:
Log.CloseAndFlush();
Example from NLog:
LogManager.Shutdown();
I cannot seem to find a similar feature of Microsoft.Extensions.Logging. I know that providers indirectly implement IDisposable
but Dispose
doesn’t seem to be consistently called on shutdown.
Is there any way of detecting that an application is about to shut down or would it be possible to implement support for this in Microsoft.Extensions.Logging?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Flushing buffered data at shutdown #1496 - fluent/fluent-bit
I'm trying to replace fluentd to fluent-bit for reducing container size, but fluent-bit seem not to flush data in buffer when shutting down....
Read more >Do I need to flush events when shutting down using logback?
In the shutdown of our application we currently call: org.apache.log4j.LogManager.shutdown();. Which is supposed to flush all async logging and ...
Read more >Remember to flush Application Insights on shutdown!
Here is how to ensure that Azure Application Insights logs and performance are not lost on shutdown, all while also optimizing log ...
Read more >Avoiding File Flush at Server Shutdown
The c‑tree Server flushes files to disk when it is shut down. In the case of a “scratch” or “temp” file, it may...
Read more >No flush cache on shutdown
So demanding a "no flush" on shutdown seems a little naive to me. If you really want a fast shutdown and still using...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yep 😄 !
That’s a good point 😂 I guess this would be the way to go?