-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is there the "force send all logs from buffer" feature? #102
Comments
Hi there and welcome to this repository! A maintainer will be with you shortly, but first and foremost I would like to thank you for taking the time to report this issue. Quality is of the highest priority for us, and we would never release anything with known defects. We aim to do our best but unfortunately you are here because you encountered something we didn't expect. Lets see if we can figure out what went wrong and provide a remedy for it. |
Hi! I don't think individual sinks have the option to flush, but Serilog itself does. Look for |
The more I think about it, the trickier it gets. It hasn't to do with whether the log events are saved on disk or only held in memory. It has to do with the fact that there are external dependencies that might not accept the log events, and what should then happen? We cannot prevent the process from terminating indefinitely. One of the better solutions would be to provide a timeout to the flush operation, aborting if flushing isn't complete before the timeout hits. But this isn't something I've planner for, nor is it something that has been requested by any other than yourself. |
I'm running into this right now. I've got a small console program that is logging some stuff and then terminates. I do call Any thoughts on this one? I might be able to help with a PR if this is appreciated, but I'm not sure if the internals of serilog even allow us to hook into the CloseAndFlush as a sink (have not looked into this). |
I think we ought to start with defining the requirements. I don't think we can reason on implementation details until we know what to expect from the functionality. Some of the requirements will be pretty straight forward, but there will be some edge cases that will require some discussions. I will continually update this post with new requirements as they appear in this issue. Please help me with the requirements as you see them. Requirements
|
I'm also running into this issue, but not because the application is shortlived. It's because I'm testing the logging and mocking out the IHttpClient (used by Http sink) to verify the formatting of the log output for NewRelic. The NewRelic sink currently does not support logging (ironically), just other NewRelic features. Anyway so I want to verify the logging JSON format etc. and I can wait 5000 in the test, but it would be nicer to just force the logs to flush on command for testing. Is something like this possible? It doesn't have to be as "pretty" as normal code, in my opinion. |
Do we have any update on this ? I am running into exactly the same problem. Short lived application does not send any logs :( even when added |
No progress has been made with this issue. |
Hello! First of all, thank you for this library, I really like to use it.
I'm sorry if it's not the right place to ask my question.
Here is it. I have a desktop application that connected to external API and sends logs to it.
So I want to handle a situation when I need to be sure that all logs from the buffer are sent and only after I want to shut down this desktop app
I checked the repository code but didn't find anything similar. So, is there a feature like this or should I look for a workaround?
The text was updated successfully, but these errors were encountered: