datalust / serilog-sinks-seq

A Serilog sink that writes events to the Seq structured log server
https://datalust.co/seq
Apache License 2.0
239 stars 50 forks source link

Not all log entries are written when using serilog und Winforms app #175

Closed duetscha closed 2 years ago

duetscha commented 2 years ago

Hello,

first off - thank you for providing Serilog :-)

I´ve seached Google & Co quiet a while without any result, so sorry if my question has been answered somewhere...

I´ve been using Serilog within Blazor server apps with no problems and decided to use Serilog for my Winforms apps as well. Conditions under which I´m using Serilog: Winforms, Framework 4.7.2, Windows 10. Unfortunately it seems that, when I´m taking a look into the written log-files, the last 1-5min of logging are missing and are never written - no matter how often I call Log.CloseAndFlush. This behavior is not exactly reproducable - sometimes all entries have been written, sometimes not.

This is how I initialize Serilog: Serilog.Log.Logger = new LoggerConfiguration() .Enrich.FromLogContext() .MinimumLevel.ControlledBy(levelSwitch) .WriteTo.File(new Classes.SewCompactJSonFormatter(), m_file, rollingInterval: RollingInterval.Day, fileSizeLimitBytes: _50MB, retainedFileCountLimit: 5, rollOnFileSizeLimit: true, shared: true, flushToDiskInterval: TimeSpan.FromMilliseconds(1000)) .CreateLogger();

I call the CloseAndFlush on certain user actions. But even directly after that it is not guaranteed that alle logs are written.

Any help or advice would be appreciated :-)

Thanks you in advance,

Andre

nblumhardt commented 2 years ago

Hi Andre; this is the repository for the Serilog Seq sink, which it doesn't appear that you're using. This could be a good one to post to Stack Overflow, to get the right eyes on it?

duetscha commented 2 years ago

Now that was quick :-) Can you explain that a bit more detailed? I mean the part with the Serilog Seq sink - I´m indeed only using then file sink... Asking the question on Stack Overflow is of course a good idea though.

nblumhardt commented 2 years ago

Hi! You're in datalust/serilog-sinks-seq where we maintain a different piece of software, Serilog.Sinks.Seq. If you need help on Serilog configuration, Stack Overflow is the place to go. Hope this helps, and good luck with it!

nblumhardt commented 2 years ago

Ah sorry, I think I see where the confusion stems from:

first off - thank you for providing Serilog :-)

Datalust doesn't provide Serilog, it's a community OSS project. I'm the original author and one of the maintainers, and I also founded Datalust (the organization behind this repository), but they're separate things. HTH!