serilog-contrib / serilog-sinks-slack

A simple (yet customizable) Slack logging sink for Serilog
MIT License
41 stars 27 forks source link

Application exit before slack log is "slacked" #35

Closed mthgr closed 2 years ago

mthgr commented 2 years ago

I've started using this project and I've noticed that alerts are not slacked before my console application exit.

I'm not sure if this is a bug? Or is this the expected behavior?

For now, I've added a thread sleep before exit but I'd like to know if it's a bug and if not how people using this library usually account for this...?

I've been using another slack sink (ServiceStack.Logging.Slack) and all slack alerts are slacked properly before the application exit without adding a thread sleep.

But I need to use ServiceStack.Logging.Serilog and if I want to use Slack I need to use serilog-sinks-slack with it.

It seems it's possible to do this without adding a Thread sleep since it works with the default ServiceStack.Logging.Slack.

Thanks for any pointers ;-)

augustoproiete commented 2 years ago

Expected behavior. You need to call Log.CloseAndFlush() before your application ends: