Ask a Question
Back to All

Serilog is not writing log to Seq until Log.CloseAndFlush() is invoked

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()

Is there any way to log without invoking Log.CloseAndFlush() so that it works with seq, serilog in console application.

Do I need to call Log.CloseAndFlush() everytime after logging? If I have a console application who listen a queue and do some operation, on that case where I will invoke Log.CloseAndFlush()?

Expecting your help.