#1 2023-07-03 20:04:22

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Stack Overflow in LogView

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

#2 2023-07-04 06:30:32

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Stack Overflow in LogView

I have sent you a private message.

Online

#3 2024-05-22 08:19:26

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Stack Overflow in LogView

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

#4 2024-05-22 08:48:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: Stack Overflow in LogView

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.

Online

#5 2024-05-22 09:23:03

itSDS
Member
From: Germany
Registered: 2014-04-24
Posts: 516

Re: Stack Overflow in LogView

Good Tip thank you very much


Rad Studio 12.1 Santorini

Offline

Board footer

Powered by FluxBB