#1 2014-06-03 13:07:17

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

TSynLog.Log(sllError, 'a test msg') always add stack trace?

Hello Arnaud,

I'm using the source downloaded less than 2 weeks ago, and noticed that code like this:

TSynLog.Log(sllError, 'a test msg')

always add very long stack trace after the log msg? Example result:

20140603 20491541 a test msg, stack trace API 006A0063 BaseBackgroundWorker.TBaseBackgroundWorker.SendLogToFile (109) 0069FFA9 

Note the above log message and the stack trace are in the same line.

I have tried adding NOEXCEPTIONINTERCEPT conditional define to the project option, the result is the same.

How to disable these stack traces? Thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#2 2014-06-04 05:06:18

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: TSynLog.Log(sllError, 'a test msg') always add stack trace?

well, tested the latest source downloaded ten minutes ago, it's the same problem.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#3 2014-06-04 05:32:32

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: TSynLog.Log(sllError, 'a test msg') always add stack trace?

For those who have the same question, here is the solution.

    FLogger.GenericFamily.LevelStackTrace := [];

PS,

FLogger.Family.LevelStackTrace := [];

doesn't work, what's the difference between

TSynLog.Family

and

TSynLog.GenericFamily

, how do I know when to use which one?

Thanks, Arnaud.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#4 2014-06-04 05:40:19

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: TSynLog.Log(sllError, 'a test msg') always add stack trace?

A further comment to ab, when auto-appending stack trace is enabled in TSynLog, I expect the log reader, TSynLogFile.EventText[aIndex] to return only the log message, but not with the very long stack trace, and this behavior is why I asked this question at the first place. Is this by design, or a bug or anything I misunderstood? Thanks.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

#5 2014-06-04 07:30:03

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

Re: TSynLog.Log(sllError, 'a test msg') always add stack trace?

I suppose your FLogger is a TSynLog instance, not a TSynLog class instance.
This is why Family / GenericFamily do not return the same value.

TSynLogFile.EventText[] returns the whole log message line.
In the log viewer application, you have one message per line, so it is convenient to use.
The stack trace is expanded in the bottom detailed memo.
So it depends on your application to retrieve the needed information, but EventText[] returns all you need.

Online

#6 2014-06-04 08:03:41

edwinsn
Member
Registered: 2010-07-02
Posts: 1,218

Re: TSynLog.Log(sllError, 'a test msg') always add stack trace?

yes, I use a TSynLog instance, but not directly the class.


Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.

Offline

Board footer

Powered by FluxBB