You are not logged in.
Pages: 1
Offline
Based on code tracing, an excessively small RotateFileSizeKB is not the key cause of the issue. The PerformRotation method is only invoked within the following method:
procedure TSynLog.LogEnterFmt(nfo: PSynLogThreadInfo; inst: TObject;
fmt: PUtf8Char; args: PVarRec; argscount: PtrInt);
However, the check and invocation of PerformRotation are missing in the method below:
procedure TSynLog.LogEnter(nfo: PSynLogThreadInfo; inst: TObject; txt: PUtf8Char
{$ifdef ISDELPHI} ; addr: PtrUInt {$endif});
This means that calls like `l := TSynLog.Enter;` cannot trigger the rotation check.
This is the first bug.
Even if we use TSynLog.LogEnterFmt (which can trigger the rotation check), the check relies on the following condition:
if pendingRotate in fPendingFlags then // from OnFlushToStream
PerformRotation;
And the OnFlushToStream event is only assigned to fWriter.OnFlushToStream if AutoFlushTimeOut is explicitly set to a non-zero value:
if fFamily.AutoFlushTimeOut <> 0 then
begin
fWriter.OnFlushToStream := OnFlushToStream; // note: overwrites fWriterEcho
OnFlushToStream(nil, 0);
fFamily.EnsureAutoFlushThreadRunning;
end;
In other words, if I do not explicitly set AutoFlushTimeOut, OnFlushToStream will never be triggered—and consequently, PerformRotation will not run either.
This is the second bug.
Thirdly, even if the above two bugs are fixed, the PerformRotation check is only invoked in methods related to TSynLog.Enter. Calls like TSynLog.DoLog or TSynLog.Add.Log will still not trigger rotation checks. This behavior may require further improvement, or at the very least, explicit documentation to clarify it.
Offline
Should be better with
https://github.com/synopse/mORMot2/commit/1aa25915d
and
https://github.com/synopse/mORMot2/commit/a35674615
and
https://github.com/synopse/mORMot2/commit/e327e4a75 to harden the rotation itself.
Offline
Pages: 1