Send call stack to own trace system

delphi package - automated exception handling
Post Reply
hewy
Posts: 9
Joined: Mon Oct 14, 2013 12:42 pm

Send call stack to own trace system

Post by hewy »

currently we are evaluating several Exception handling solutions. One of them is MadExcept.
We have a large application that has currently his own exception handling solution.
Now we would like to extend error tracing specially we need to add call stack in case of error. This should run in the background without affecting the user interface.
All error logs shall be send to our already existing reporting system.
How could i realize such a solution using madExcept?
madshi
Site Admin
Posts: 10527
Joined: Sun Mar 21, 2004 5:25 pm

Re: Send call stack to own trace system

Post by madshi »

First of all you will want to disable the GUI stuff, since you don't seem to want it. You can do that by:

(1) disabling the "show please wait box" here:

http://help.madshi.net/madExceptSettings2.htm

(2) settings the bottom right combobox to "don't show anything" here:

http://help.madshi.net/madExceptSettings3.htm

You may also want to disable automatic bug report saving and sending here:

http://help.madshi.net/madExceptSettings2.htm

The next thing you need to do is install your own little exception handler. You can do this by using the following code:

Code: Select all

uses ..., madExcept;

procedure YourExceptionHandler(const exceptIntf: IMEException; var handled: boolean);
begin
  SendBugReportToYourOwnReportingSystem(exceptIntf.BugReport);
  handled := true;
end;

initialization
  RegisterExceptionHandler(YourExceptionHandler, stDontSync, epCompleteReport);
end.
The IMEException interface has a lot of properties, so you can collect all kinds of information about the crash and send it to your own reporting system.

Please note that when using the parameter "stDontSync" your exception handler will be called in the context of a secondary thread. That means your code must be thread safe and must not use any VCL stuff (like showing VCL windows etc).
Post Reply