Root > How to... > ...add/save exception to a log? > ...send/upload exception to a file/DB/folder?

...send/upload exception to a file/DB/folder?

Previous pageReturn to chapter overviewNext page   

EurekaLog has two types of bug reports:

1. A local bug report. This is a text file (.el) with information about exception. This bug report type is enabled by default, and it is created always on all unhandled exceptions. The default saving location is sub-folder of the %APPDATA% folder.
2. A bug report for sending. It is a collection of files (.elp), such as a copy of local bug report, screenshot and any additional files (opened document, dumps, etc.). This bug report type is disabled by default, and it is created (for sending) only when user clicks "Send report" button in the exception dialog. The file is not stored locally, but it is transmitted to you (the developer) via e-mail, bug tracker or any other send method of your choice.

 

 

Exception Info

If you want to just add/save exception info (such as class, message, call stack and may be some other minor details) to an external log file or a database - see How to add/save exception to a log?

 

 

Local Bug Report File

If you want to send/upload a local bug report file (.el file) into database/folder - you can use code like this:

 

uses
  EException, // for TEurekaExceptionInfo
  EEvents;    // for RegisterEventExceptionAction
 
// Called on all unhandled exceptions
procedure UploadBugReport

 (const ACustom: Pointer; 

  AExceptionInfo: TEurekaExceptionInfo; 

  var AHandle: Boolean; 

  var ACallNextHandler: Boolean);
var
  LocalBugReportFileName: String;
begin
  // Get current bug report file
  LocalBugReportFileName := AExceptionInfo.ExpandEnvVars(
    AExceptionInfo.Options.OutputLogFile(''));
  // should be something like (by default):
  // %APPDATA% + '\Neos Eureka S.r.l\EurekaLog\Bug Reports\' +
  // 'Project1.exe\Project1.el'
 
  // Should not trigger
  if not FileExists(LocalBugReportFileName) then
    Exit;
 
  // Copy/send/upload the file
  // This is just an example
  // Replace it with your own code
  CopyFile(PChar(LocalBugReportFileName),
    // It is probably a good idea to make file names unique
    // to avoid overwriting old reports
    PChar('D:\NetworkFolder\' + ExtractFileName(LocalBugReportFileName)), False);
end;
 
initialization
  // Instruct EurekaLog to call your code on all unhandled exceptions
  RegisterEventExceptionNotify(nil, UploadBugReport);
end.

 

Note: this code is called before exception dialog is displayed, so any changes in bug report for future sending (such as user contact e-mail or steps to reproduce) are not in this bug report.

 

 

Bug Report File for Sending

If you want to send/upload a bug report file for sending (.elp file) into database/folder - see How to save report instead of sending it?

 

Note: this code is called only if user clicks on the "Send Bug Report" / "Save Bug Report" button in the exception dialog. See also: How to send report automatically?

 

 

See also:




Send feedback... Build date: 2024-12-19
Last edited: 2023-08-09
PRIVACY STATEMENT
The documentation team uses the feedback submitted to improve the EurekaLog documentation. We do not use your e-mail address for any other purpose. We will remove your e-mail address from our system after the issue you are reporting has been resolved. While we are working to resolve this issue, we may send you an e-mail message to request more information about your feedback. After the issues have been addressed, we may send you an email message to let you know that your feedback has been addressed.


Permanent link to this article: https://www.eurekalog.com/help/eurekalog/how_to_send_exception.php