serilog / serilog-sinks-periodicbatching

Infrastructure for Serilog sinks that process events in batches.
Apache License 2.0
71 stars 29 forks source link

Option for flush on fatal message #20

Closed MartinDemberger closed 6 years ago

MartinDemberger commented 6 years ago

I'm using the mail sink to send critical errors. Most of the time the log-messages which describes why my application is killed aren't sent. I guess this is because the server process is killed before the periodic batch is sent. I think it might be a good idea to give a option like "send fatal messages immediately".

splendid25 commented 6 years ago

I had the same issue, and solved it by calling Log.CloseAndFlush() just before the process end.

nblumhardt commented 6 years ago

Calling Log.CloseAndFlush() is the way to go, though there are some ongoing discussions on serilog/serilog regarding some kind of flush mechanism - thanks for the input!