You are not logged in.
Delphi 13.0, Windows 64 Bit
Lazarus 4.1, FPC 3.3.1, Windows 64 Bit
mORMot 2, Commit 2.3.12723
The problem arises in unit mormot.core.log. Function SynLogException is called.
procedure SynLogException(const Ctxt: TSynLogExceptionContext);
...
// minimal exception logging to all other TSynLog files (to ease debug)
for i := 0 to high(SynLogFamily) do
begin
fam := SynLogFamily[i];
if (fam <> HandleExceptionFamily) and // if not already logged above
(Ctxt.ELevel in fam.Level) then
try
DoLogException(fam.fGlobalLog, Ctxt);
except
Function DoLogException calls LogHeaderNoRecursion(Log.fWriter, Ctxt.ELevel, @nfo^.CurrentTimeAndThread). Log.fWriter is Nil here. The LogHeaderNoRecursion function looks like this:
procedure LogHeaderNoRecursion(WR: TJsonWriter; const Level: TSynLogLevel;
TimeStampAndThreadNum: PShortString);
{$ifdef HASINLINE} inline; {$endif}
begin
WR.AddShort(TimeStampAndThreadNum^);
Here, WR is not checked for Nil and EAccessViolation is triggered. The same behaviour occurs with Lazarus/FPC Windows 64-bit. The call stack shows that it starts via the SynLogVectoredHandler function. Delphi Windows 32-bit runs with the same source code without any problems because this function is not called.
With best regards
Thomas
Offline
How did you define your several TSynLog classes?
I can't reproduce the issue here.
Anyway, it should be better now with:
https://github.com/synopse/mORMot2/commit/2536799c6
Thanks for the feedback!
Offline