You are not logged in.
Pages: 1
Hi Arnaud,
i get Stack Overflow in Log Viewer (64Bit) Not (32Bit) - Where Should i send the Log file ?
Last edited by itSDS (2023-07-03 20:11:43)
Rad Studio 12.1 Santorini
Offline
Hi Arnaud, today i had a litte bit of time to fix the Problem.
in my Code a had lots of
TSynLog.Add.Log(sllEnter, .... (Used in Class Procedure)
But there is no automatically genereted sllLeave
LogView uses a recursive function: ComputeProperTime to calc times
This was called to often.
i made to things:
1. i increased the Stack Size of LogView with Compiler Switch: {$M 16384,4194304}
2. i changed the sllEnter to sllDebug
How can i use sllEnter in class functions/procedures to get runtime ?
Should i manually add sllLeave ?
Rad Studio 12.1 Santorini
Offline
sllEnter is to be used internally.
You should just use TSynLog.Enter() to generate it - with an associated interface, which will generate the sllLeave.
If you use sllEnter with no sllLeave, the LogView will clearly don't like it, and is likely to crash - as expected.
You could manually generate sllEnter / sllLeave, but there is still a risk of forgetting to call sllLeave if an exception is raised... so you would end up with writing try...finally blocks... therefore using TSynLog.Enter() sounds a more viable approach.
Hint: due to a change in the latest Delphi compiler, you have to use a ISynLog local variable, or a "with TSynLog.Enter() do begin end" block otherwise you don't have any timing.
If you don't need the dual enter/leave events, you can use a regular sllDebug.
To have timing, you can use this pattern:
procedure TMyClass.MyMethod;
var start: Int64;
begin
QueryPerformanceMicroSeconds(start);
...
TSynLog.Add.Log(sllDebug, 'MyMethod took %', [MicroSecFrom(start)], self);
end;
This is the lightest / safest / fastest pattern to add timing in logs, if you don't want to use TSynLog.Enter and its hidden ISynLog interface.
Offline
Good Tip thank you very much
Rad Studio 12.1 Santorini
Offline
Pages: 1