Closed Silic0nS0ldier closed 5 years ago
Hi, the logger provider waits for all queued messages to be sent when it is diposed (GelfLoggerProvider.Dispose()
calls GelfMessageProcessor.Stop()
). To ensure this happens on shutdown when using .NET Core dependency injection, you need to make sure the service provider is disposed of like in the (sample console app)
Thanks for the switch response, Dispose
didn't even cross my mind. Adding it in seems to do the trick (there is a slight delay which indicates that something is happening), however I can't say for sure. It would seem I broke something since I last had it in a working state, much to my frustration.
Anyway, concern has been allayed, so closing.
Currently there is no way to determine if all queued log entries have been sent, and as a consequence when a logs may potentially be lost.
This can present a problem in scenarios where an web app has entered an unrecoverable state and can only perform a controlled crash. Or in the case where I discovered this issue, in a short lived console app.
There are 2 ways I can see this limitation being overcome.
Main difference across both would be how quick to close when there is a backlog.