serilog-sinks-mysql
serilog-sinks-mysql copied to clipboard
CloseAndFlush don't work
protected override async void OnExit(ExitEventArgs e)
{
try
{
_mutex?.ReleaseMutex();
_mutex?.Close();
}
catch (Exception)
{
// ignored
}
finally
{
if (e.ApplicationExitCode == 0)
{
Log.Information("exit");
await Log.CloseAndFlushAsync();
await Dal.DalBase.Save2DbAsync(new ActionLog("exit"));
}
base.OnExit(e);
}
Always miss the last few message in mysql . And i find out that sink to file is ok. Seems CloseAndFlushAsync() has some issues.