serilog-sinks-azuretablestorage is silently dropping log events, but serilog-sinks-file records them fine.
daiplusplus opened this issue · 2 comments
I noticed that many times the serilog-sinks-azuretablestorage
sink will simply not add logged events to the Azure Table Storage table, even though serilog-sinks-file
will correctly write them all to disk.
This often happens when there's a logged event that occurs very frequently. Such as earlier today when I pushed an update to my web-app into production that had a bug I was unaware of that was causing a (caught) exception which called Microsoft.Extensions.Logging.ILogger<T>.LogError( Exception, String )
resulting in a few thousand log items being saved using ``serilog-sinks-file` in a couple of hours - but the Azure Table only contained a couple of logged exceptions (including those from the same call-site and stack-trace, but during periods of lower usage counts in my web-app) - so I wasn't aware of this problem because I prefer checking the Azure Table Storage logs using Storage Explorer than downloading the Serilog files locally.
I did wonder if maybe an uncaught exception was causing Serilog's background batch-processing thread to die, but in that case the serilog-sinks-file
files should be empty - but they're not. So I strongly suspect something is failing inside serilog-sinks-azuretablestorage
- but it's just silently dropping the events instead of throwing an exception of its own,
The Sink in version 8 has been rewritten. Batch write is now on by default. Make sure to call Log.CloseAndFlush(); on application close. Please reopen if still an issue