Problem
The application terminates before the sink has finished uploading the logs to the database.
To reproduce
Create a small console app in which you create a logger, log something, dispose the logger and exit.
Most of the time the application will terminate almost istantly and the log won't be written to the database.
Source of the bug
In the constructor of the class BatchProvider the task _batchTask, which is responsible for sending logs, is initialized using the Task.Factory.StartNew

This task should be completed only when all the logs have been written to the database, but it's not the case.
This causes the Task.WaitAll in the Dispose() method to return before all the logs have been written to the database
To make sure that _batchTask waits for all the internal tasks to finish you need to call the Unwrap() method.
This SO explains it better than i can task-factory-startnew-wont-wait-for-task-completion