Attach dynamically a log file to the email bug report

delphi package - automated exception handling
Post Reply
geekobi
Posts: 5
Joined: Wed Mar 22, 2017 3:08 pm

Attach dynamically a log file to the email bug report

Post by geekobi »

Hi,
I'm trying to add an attached file to the emailed bug reports.
The attachment must be done programmatically and not by the properties settings because the name of the file depends on the connected user name.

In the madexcept help, I found :
// Examples:
MESettings.AdditionalAttachments.Add('c:\boot.ini');
exceptIntf.AdditionalAttachments.Add(ParamStr(0), '', 'crashingExe.zip');

And it doesn't work, so I digged into the issue and :
- I found the use clause for the MESettings object : "use madexcept" is ok,
- but I found no use clause for the exceptIntf object
- I found no reference to the 'AdditionalAttachments' word into the demos provided with madcollection,
- I found 2 references to 'exceptInt', but they were parameters of a function, so it was not usefull in my case

So I don't know what to do further
If anybody can help or has a sample code, I thanks him in advance.
My current language is Delphi 6.
madshi
Site Admin
Posts: 10754
Joined: Sun Mar 21, 2004 5:25 pm

Re: Attach dynamically a log file to the email bug report

Post by madshi »

Additional attachments need to be added in an exception handler. See "RegisterExceptionHandler()". I'd suggest "stDontSync" and "epMainPhase" parameters. Your exception handler then receives an "exceptIntf" parameter which you can use to call "exceptIntf.AdditionalAttachments.Add(...)".
geekobi
Posts: 5
Joined: Wed Mar 22, 2017 3:08 pm

Re: Attach dynamically a log file to the email bug report

Post by geekobi »

Thanks for madshi answer,
Finally, I used this and it worked (I got the log file attached in the email bug report) :

Code: Select all

uses madExcept;
MESettings.AdditionalAttachments.Add(log_filename);
I continue my tests because of madshi answer which is different and I will let you informed if I got issues with mine.
Post Reply