Serilog and Seq works fine when I log from WinForm/web application. I am facing problem only when I am using console application. Without writing Log.CloseAndFlush() it is not working. Following is my LoggerConfiguration
Log.Logger = new LoggerConfiguration()
.WriteTo.Seq("http://localhost:5341")
.CreateLogger();
Is there any way to log without invoking Log.CloseAndFlush() so that it works with seq, serilog in console application.
Log.CloseAndFlush() only needs to be called once in a console application, before the application exits. It's a "shutdown" method that ensures any buffered events are processed before the application exits.
The Serilog Lifecycle of Loggers documentation has some more detail on CloseAndFlush().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With