Page 1 of 1

Attach dynamically a log file to the email bug report

PostPosted: Tue Mar 28, 2017 8:22 am
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.

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

PostPosted: Tue Mar 28, 2017 1:37 pm
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(...)".

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

PostPosted: Wed Mar 29, 2017 10:35 am
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.