Eurekalog: save exception stacktrace into a log file
Asked Answered
G

2

5

I'm using delphi 7.

I need to log to a file the complete informations of any exception that occurs.

Normally I use Eurekalog. This wonderful product shows a dialog with all the stack trace information and many many others for debugging purpouse.

I need to access this informations Eureka log gives me (really I need just the stack trace) because I need to send them in a syslog deamon. Is there a way to access the information from the Eureka log programmatically ?

I can use the bare delphi 7 or Eurekalog 6.1

Gopherwood answered 13/8, 2012 at 15:51 Comment(7)
Are you asking someone to write some code for you? What have you already tried? Are you really asking, "Is there a way to access the information from the Eureka log programmatically?" On SO, asking for pointers is fine -- asking for someone to write the code for you is not.Malvaceous
EurekaLog should have the option to save the exception to file; check the documentation. From there, it's just a matter of loading the file into a stringlist (or reading it line by line) and extracting the part you want into whatever you want it in.Soinski
Do you want every single exception logged, or just unhandled ones? And did you ask at EurekaLog forums/support? It's their product. Ask them first.Amiens
Changed to a phrase with question markGopherwood
Jako, your comment should have gone in the "edit summary" box when you edited the question.Ceres
Can EurekaLog be added to title and/or tags ? There are a lot of exception tracers, madExcept, IDE-embedded Jedi CodeLib, something in mORMot, many logging tools provide that and so on. Thisparticular question is not how to do it in Delphi using/choosing right lib, but how to do it with EurekaLog exactly. So i beleive for more correct searching in future, the tagsset and title should be narrowed to reflect real question.Costa
You don't need to ask anyone else to make those edits, @Arioch. You can make them yourself. Your reputation is low, so someone will have to approve your edits, but everyone who's eligible to do so will see a notification in the Stack Overflow header bar.Ceres
C
9

Handle the OnExceptionNotify event. In your event handler, do whatever you want with the AExceptionInfo.CallStack property, such as saving it to disk or sending it to some other process. Note that EurekaLog already saves bug reports to disk by default, so if that's all you want to do, you don't need any special code.

Use RegisterEventExceptionNotify to register your event handler, or use a TEurekaLogV7 component. For details and general information on handling EurekaLog events, see the documentation for the EEvents unit.

OnExceptionNotify occurs for unhandled exceptions. If you want to be notified of any exception, including ones that eventually get handled within your program, then you should use the OnRaise event instead.

Ceres answered 13/8, 2012 at 17:21 Comment(2)
Kind of, @Warren. I had to read a lot of the manual today before I discovered that those events even exist. I found no mention of them in the regular guide section (getting started, basic procedures, typical scenarios, FAQ, not even advanced topics). I only found them by reading the reference section.Ceres
I guess my comment got deleted because someone thought the acronym implied something rude.. :-)Buttons
D
2

Most people simply use JCL Debug.

Discussions on TSynlog http://blog.synopse.info/post/2011/04/14/Enhanced-logging-in-SynCommons

or by Hallvard Vassbotn http://hallvards.blogspot.co.at/2008/03/tdm9-exceptional-stack-tracing-hvest.html

Defile answered 13/8, 2012 at 17:16 Comment(5)
On an application that is not already using EurekaLog or mad except, this is the way to go.Buttons
Why would switching from EurekaLog to a different tool help? -1Amiens
It wouldn't. But some people might google and find this question and not already be using one of the other tools.Buttons
Well, then you'd definitely enlist madExcept as well. And half-dozen logger tools. TSynLog does not make stacktraces for its own merit, but just for logging. Almost any logger framework do the same. About JCL - i'd add that not only some "people", but Delphi IDE itself uses it :-)Costa
Oh! Don't worry Warren and Arioch. David H. is mathematician. He is totally right concerning the question. He is very precise.Defile

© 2022 - 2024 — McMap. All rights reserved.