0
Follow
0
View

How to prevent .net 6 generic hosted console apps logging queue from being shutdown on application stop?

cyclone_yzy 注册会员
2023-01-25 23:33

I would wrap the app.Start in a try/catch/finally ... and depending on whether you're using something like Serilog ... call Log.CloseAndFlush() in the finally.

Similar question here: How can I flush all loggers in a dotnet core appliation just before doing a Environment.Exit()