You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An issue in serilog-sinks-file-header suggested something wrong with handling of the OnFileOpened hook, as the header was being written precisely every 30 minutes. I've been able to reproduce this by using a configuration where files are rolled by size and not time, e.g.:
So, after every log is written by RollingFileSink.Emit(), it calls into AlignCurrentFileTo(), which in turn calls into OpenFile(), where we see:
// We only try periodically because repeated failures// to open log files REALLY slow an app down._nextCheckpoint= _roller.GetNextCheckpoint(now)?? now.AddMinutes(30);
This is the source of the 30-minute oddity.
@nblumhardt Unless I'm missing something (very possible 😄), we can fix this in RollingFileSink.Emit():
...// Current code
var now = Clock.DateTimeNow;
AlignCurrentFileTo(now);
...// Proposed codeif(_retainedFileTimeLimit.HasValue){varnow= Clock.DateTimeNow;
AlignCurrentFileTo(now);}
The text was updated successfully, but these errors were encountered:
Hmm interesting! I need to take a closer look; at first glance, it seems like the proposed fix would prevent rolling on date/time from being correctly performed, where we roll but don't set a time limit? 🤔
An issue in serilog-sinks-file-header suggested something wrong with handling of the
OnFileOpened
hook, as the header was being written precisely every 30 minutes. I've been able to reproduce this by using a configuration where files are rolled by size and not time, e.g.:So, after every log is written by
RollingFileSink.Emit()
, it calls intoAlignCurrentFileTo()
, which in turn calls intoOpenFile()
, where we see:This is the source of the 30-minute oddity.
@nblumhardt Unless I'm missing something (very possible 😄), we can fix this in
RollingFileSink.Emit()
:The text was updated successfully, but these errors were encountered: